I have a Requirement like this
I need to update an existing WTDocument that is attached to a deliverable within a plan activity. The update involves the following steps:
Please help me solve this requirement.
Interesting coding project 👍
Item 1 is clear and I have the code to do this figured out.😁
The code is passed three arguments: the Plan, the current doc and the replacement doc. Works well.
Item 2 is not clear. You cannot attach a Windchill document as “primary attachment”.
BTW, I think you mean “primary content” not “primary attachment”.
Your choices are primary content or an attachment but in either case you cannot attach a WTDoc. You can only attach files, URLs and external storage locations.
I’m thinking you meant to say, replace the primary content of doc 1 with the primary content of the replacement doc. Is that what you’re trying to say? 🤷♂️
If yes, I have the code to replace the primary content of one WTDoc with another doc’s primary content.
Item 3 is not clear. There is more than one link type that can link WTDocs. You might want state which one you want.
Item 2: Yes
Item 3: as shown in the picture. new document / replacement doc should add as a child of the current doc.
0000030156 (Document Number): existing doc as deliverable ( no structure at the beginning)
0000010083 (Document Number), new replacement document (after replacement, the new replaced document attached as a child to existing doc )
The Below image i have attached this how the requirement, before replacement and after replacement. please help me to solve this, if if you have any code please shar.
Now that we know the exact specification of this utility here it is.
We start with two WTDocs. One has a plan and primary content and no structure.
Note there is no structure.
The other WTDoc has no plan and primary content different than the first doc.
Now, we run the utility and the plan will be moved to the second WTDoc,
The primary content of the first WTDoc will replace the second WTDocs primary content.
The second WTDoc will be linked to the structure of the first WTDoc.
The plan has been moved to the second doc.
The primary content of the first doc has been copied to the second doc.
NOTE: The doc was not iterated. 😉
BTW, there are a few ways to copy the primary. The technique I used has both WTDocs using the exact same file in the file vault.
The second doc has been added to the structure of the first doc.
NOTE: The doc was not iterated 😉
So, very doable.