Skip to main content
12-Amethyst
November 16, 2024
Solved

Programmatically change the Subject of the deliverable inside Plan Activity & make Primary Attachmen

  • November 16, 2024
  • 1 reply
  • 1596 views

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:

  1. Replace the currently attached WTDocument with a new one.
  2. Set the newly attached WTDocument as the primary attachment to the previous WTDocument.
  3. Link the newly attached WTDocument as a child document to the previously attached WTDocument.

Please help me solve this requirement.

 

Best answer by RaikarRaghu

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)

-----------------------------------------------------

1 reply

18-Opal
November 16, 2024

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.

12-Amethyst
November 17, 2024

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 )

RaikarRaghu_0-1731826011772.png

 

12-Amethyst
November 17, 2024

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.