Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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
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
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
}
}
Solved! Go to Solution.
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).
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).
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?
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).
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 ?
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.
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.
Hello, Yadavankur, opened Promotion Preference Management. How to use them to understand what template is needed?
I can't read Cyrillic (assuming it is Cyrillic), but what you have under Current Processes: are the two processes you should be modifying. The Life Cycle State for Promotion is the state user picks when promoting the object, and the workflows are the two options. You have another Preference for All states, and therefore it might be the one more applicable to your case, not the Test18 In Analysis one that you have highlighted, unless you are testing those workflows only.
yadavankur, thank you, the right template was found, but now there is a problem with the code. Tell me, please, what type should have a variable obj ? I've tried every type I know, but I haven't passed the test
Checking Syntax...
warning: Supported source version 'RELEASE_7' from annotation processor 'com.microsoft.azure.management.apigeneration.LangDefinitionProcessor' less than -source '1.8'
WfExpression_11.java:54: error: cannot find symbol
obj = results.nextElement();
^
symbol: variable obj
location: class WfExpression_11
WfExpression_11.java:55: error: cannot find symbol
if (obj instanceof wt.doc.WTDocument)
^
symbol: variable obj
location: class WfExpression_11
WfExpression_11.java:57: error: cannot find symbol
var += obj.getName ()+","; // var is a global variable
^
symbol: variable obj
location: class WfExpression_11
Note: WfExpression_11.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
1 warning
Syntax check complete.
Try wt.fc.Persistable:
wt.fc.Persistable obj = results.nextElement();
Checking Syntax...
warning: Supported source version 'RELEASE_7' from annotation processor 'com.microsoft.azure.management.apigeneration.LangDefinitionProcessor' less than -source '1.8'
WfExpression_11.java:57: error: incompatible types: Object cannot be converted to Persistable
obj = results.nextElement();
^
Note: WfExpression_11.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
1 warning
Syntax check complete.
Okay! Try using Object then:
Object obj = results.nextElement();
And if that doesn't work use java.lang.Object.
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?