Programmatically change the Subject of the deliverable inside Plan Activity & make Primary Attachmen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Programmatically change the Subject of the deliverable inside Plan Activity & make Primary Attachmen
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:
- Replace the currently attached WTDocument with a new one.
- Set the newly attached WTDocument as the primary attachment to the previous WTDocument.
- Link the newly attached WTDocument as a child document to the previously attached WTDocument.
Please help me solve this requirement.
Solved! Go to Solution.
- Labels:
-
General Customization
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @d_graham ,
Thank you for your understanding and it was completed i did it. i got some of the articles in esupport.
-----------------------------------------------------
- By Community Moderation Team
Adding information shared by the OA.
(I found the solution in one china git hub link, and there are multiple links available https://github.com/windchill-api/-/blob/master/elead/src/cn/elead/tool/wc/ProjectUtil.java)
-----------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @d_graham ,
Thank you for your understanding and it was completed i did it. i got some of the articles in esupport.
-----------------------------------------------------
- By Community Moderation Team
Adding information shared by the OA.
(I found the solution in one china git hub link, and there are multiple links available https://github.com/windchill-api/-/blob/master/elead/src/cn/elead/tool/wc/ProjectUtil.java)
-----------------------------------------------------
![](/skins/images/695EE5AD3E567050FEDD72575855ED93/ptc_skin/images/icon_anonymous_message.png)