cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

RaikarRaghu
12-Amethyst

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:

  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.

 

ACCEPTED SOLUTION

Accepted Solutions

Hello @d_graham ,

Thank you for your understanding and it was completed i did it. i got some of the articles in esupprot.

View solution in original post

5 REPLIES 5

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 )

RaikarRaghu_0-1731826011772.png

 

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.

 

d_graham_0-1732139623642.png

Note there is no structure.

d_graham_2-1732140179906.png

 

The other WTDoc has no plan and primary content different than the first doc.

 

d_graham_1-1732140053903.png

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.

d_graham_6-1732141906849.png

 

 

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.

d_graham_4-1732141230250.png

 

The second doc has been added to the structure of the first doc.

NOTE: The doc was not iterated 😉

d_graham_5-1732141448191.png

 

So, very doable.

 

Hello @d_graham ,

Thank you for your understanding and it was completed i did it. i got some of the articles in esupprot.

Announcements

Top Tags