I was trying to retrieve a doc type from TN, make some changes to it and save it to a TN as a new doc type(while leaving the original TN doc type intact).
I tried to do it this way:
wm.tn.doctype:view - to retrieve certain doc type.
MAP - to replace some values of the fields.
wm.tn.doctype:add - to upload the new doc type to the TN.
Unfortunately, this way only the original doc type gets modified. And the new copy does not get generated.
can you provide a bit more detailed outline (with screenshots?) of your usecase, please?
Remember to provide a new name to the new doctype while adding otherwise it is likely to overwrite the original one (as you described).
Thats what I made:
A few ways I tried to solve the problem:
In the map step I tried to replace Name, Id and other values of the doc type I received from VIEW step. But those changes for some reason instantly modify the original doc type, that is stored on the TN(even without invoking ADD step).
I tried to copy the values of the doc type I receive from VIEW, to a new document(this document is referencing BizDocType, so it should be okay). And then I tried to modify the new document(change values of fields like Name and ID). Those changes also instantly modified the original doc type, that is being stored on the TN(even without invoking ADD step on the copied document).
just another question:
What would be the use case for creating doc types programmatically from another existent doc type?
Use case: I just needed to be able to create new TN doc types from designer.
I thought it could be done by just copying an existing TN doc type, modifying it and sending it back to TN.