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

Where to write the code?

SOLVED
Alexandrite

Where to write the code?

Tell me please where to write the code https://www.ptc.com/en/support/article?n=CS150777 , tried many options, but failed nothing. Here is the code to add a table to the page

Description

How to add Promotion Objects to the Instructions field on the task's details page

User should see all the objects being promoted on the same page to avoid multiple clicks for navigating to the Promotion Objects page

How to add Promotion Target Objects in workflow Email Notification

 

Resolution

  1. Create global variable (say var of type String)
  2. Before activity add expression robot
  3. Append string to have all the promotion objects' numbers/names
  4. In activity create local variable
  5. Use that local variable in instructions
  • Following code can be used to get the promotion target objects

​wt.maturity.PromotionNotice notice = (wt.maturity.PromotionNotice)primaryBusinessObject;
                 wt.fc.QueryResult results = wt.maturity.MaturityHelper.service.getPromotionTargets(notice);
                 while (results.hasMoreElements())
                  {
                          obj = results.nextElement();
                          if (obj instanceof wt.doc.WTDocument)
                          {                                 
         var += obj.getName ()+“,”;         // var  is a global variable
                          }
                     }

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Where to write the code?

2019-10-10 11_18_59-00 Process.png

 

Hope this helps. The local variable should be initialized from the global variable. Local variables are only needed for activities, not for robots (like expression or email robot).

View solution in original post

15 REPLIES 15

Re: Where to write the code?

2019-10-10 11_18_59-00 Process.png

 

Hope this helps. The local variable should be initialized from the global variable. Local variables are only needed for activities, not for robots (like expression or email robot).

View solution in original post

Re: Where to write the code?

yadavankur, thank you very much, tell me, is it in the template Promotion Request Review Process should be written or in another? And how to check that the attempt was successful?

Re: Where to write the code?

Assuming your Windchill is completely out of the box, you will set up the code and the variable in the two Promotion processes that PTC provides. If you are not sure check promotion preference management under site>utilities and org>utilities If you want to use the variable in a workflow activity instruction you would use it like this {myLocalVariable} to check your attempt you will create a promotion and view the instructions on the task that you receive. Here are two example variable in use in a notification robot (not in activity).Variable.PNG

Re: Where to write the code?

clipboard_image_0.png

This all that there is in the list, in every tried on Your instructions to do, but nothing not is changing, I something do not so ?

Re: Where to write the code?

02.jpg13.jpg45.jpg

Highlighted

Re: Where to write the code?

Hi Vlad,

 

Now add your variable under the "Promotion Object table" text in curly braces:

 

5. Promotion Object table:

{MyValue}

 

Now when the task is generated the instructions will display the value of the variable. Be sure to also initialize your MyValue variable. Select the appropriate process variable (in your example it's name "var") in the "Initialize From" dropdown.

Re: Where to write the code?

Yep, that should do it, the initialize from and the parenthesis. Also Vlad, you have checked out all the workflows, I would suggest you check them in if they have the change you want or undo-checkout if you don't need them. Like I said earlier, if you do not know which workflow you want to modify, check the site>utilities>promotion preference management.

Re: Where to write the code?

Hello, Zsternal,I initialized the variable and added it under the text " 5. Promotion of the Object table". Kept the template, but nothing has changed. I did everything only in the template "Promotion Request Review Process", did I choose the template correctly?

Re: Where to write the code?

Hello, Yadavankur, opened Promotion Preference Management. How to use them to understand what template is needed?

1.JPG2.JPG