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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to customize Promotion Request task subject in UI

Gucio
15-Moonstone

How to customize Promotion Request task subject in UI

Hi All,

Is there any api to customize content of Subject of Promotion Request Task?? I was able to change Subject of emaill notyfication. Now I need to do this same i UI.

 

Gucio_0-1729091014382.png

Thank you in advance for any advice.

Krzysztof
6 REPLIES 6
Catalina
Moderator
(To:Gucio)

Hi @Gucio 

Thank you for your question!

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

Also, feel free to add any additional information you think might be relevant. 

 

Best regards,

Catalina
PTC Community Moderator

@Gucio ,

 

It is doable to change the OOTB task 'Subject' in the UI.  See image below.

As you can see. ONLY tasks from Promotion Request workflows will get the added text.

 

d_graham_0-1729468752342.png

 

You never stated EXACTLY how you wanted to change the OOTB display of the task 'Subject' so I just added some static text to show it can be done.

 

David

Gucio
15-Moonstone
(To:d_graham)

I will try to explain in more details.

 

For Promotion Request email notification subject - I've modified General*.html files from codebase\templates\workNotification. As a result new mail subject contains some variable taken from Promotion Request workflow. My gol is to have this same subject for task in UI. Can you guide me what should I do?

 

Gucio

Krzysztof

@Gucio ,

 

Can you tell me the name, display name and data type of each of the variables and EXACTLY how you want them to appear in the 'Subject'?

 

Are you keeping the OOTB Subject display and simply appending the variable to it?

Do you want the variable to be at the start of the 'Subject'?

 

Please be very clear with EXACTLY how you want the 'Subject' to appear.

A screenshot of your workflow variables and exactly which ones should appear and where/how they should appear in the 'Subject' would be helpful.  This would eliminate anymore back and forth on questions on my part.

Gucio
15-Moonstone
(To:d_graham)

 

My Promotion Request has 5 additional variables:

objectName (String);

objectNumber (String);

objectInitialState (String);

objectTargetState (String);

objectRevision (String).

 

Parameters are filed/taken from below code defined in expression:

 

wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject;

wt.fc.QueryResult queryResult = wt.maturity.MaturityHelper.service.getPromotionSeeds(pn);

wt.lifecycle.State state = null;

while (queryResult.hasMoreElements()) {
                java.lang.Object obj = queryResult.nextElement();
                if (obj instanceof wt.doc.WTDocument) {
                    wt.doc.WTDocument object = (wt.doc.WTDocument) obj;
                    objectName = object.getName();
                    objectNumber  = object.getNumber();
                    state = object.getLifeCycleState();
                    objectCurrentState = state.getLocalizedMessage(java.util.Locale.US).toString();
                    objectTargetState =  pn.getMaturityState().getLocalizedMessage(java.util.Locale.US).toString();
                    objectRevision = wt.vc.VersionControlHelper.getVersionIdentifier(object).getValue();
                }
}

 

To customize email subject of “Review” activity, I edited General***.xml files stored in codebase\templates\workNotification folder. Body of file looks as follow:

 

<body>
<font face="Arial, Helvetica, sans-serif">
<SCRIPT LANGUAGE=Windchill> activityNotificationUrl </SCRIPT>
</font>
<SCRIPT LANGUAGE=Windchill>
<!--
   activityAttributes notification=true
-->
</SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
  beginSubject 
-->   </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
getActivityName
 -->   </SCRIPT>
 <SCRIPT LANGUAGE=Windchill>   <!--
  addText text=": "  
-->   </SCRIPT> 
<SCRIPT LANGUAGE=Windchill>   <!--
  getPrimaryBusinessObjectName 
-->   </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
  addText text=", "  
-->   </SCRIPT> 
 <SCRIPT LANGUAGE=Windchill> <!--
getProcessVariable varName="objectName"
--> </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
  addText text=", "  
-->   </SCRIPT>
 <SCRIPT LANGUAGE=Windchill> <!--
 getProcessVariable varName="objectNumber"
--> </SCRIPT> 
<SCRIPT LANGUAGE=Windchill>   <!--
  addText text="; rewizja "  
-->   </SCRIPT>
 <SCRIPT LANGUAGE=Windchill> <!--
 getProcessVariable varName="objectRevision"
--> </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
  addText text=". Zmiana stanu z: "  
-->   </SCRIPT>
 <SCRIPT LANGUAGE=Windchill> <!--
 getProcessVariable varName="objectCurrentState"
--> </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
  addText text=" na "  
-->   </SCRIPT>
 <SCRIPT LANGUAGE=Windchill> <!--
 getProcessVariable varName="objectTargetState"
 --> </SCRIPT>
<SCRIPT LANGUAGE=Windchill>   <!--
endSubject 
-->    </SCRIPT>
</body>

 

As a result, reviewer receive email notification with subject, that is formatted as it was done in General***.xml file. All necessary variables are taken from expression and are used as part of subject.

Subject: (it is written in polish)

Gucio_0-1729677456791.png

 

 

But this same user in UI receive task with OOTB subject. I would like to change it. The goal is to have same subject pattern as in email.

 

Hope not it will be easier to understand my expectations.

 

Regards,

 

Krzysztof

Krzysztof,

 

I have this working to your spec.  I think. 😀

I made a workflow that has an expression robot with your code and the String variables you listed.  BTW, I had to add an additional variable that was in your code by not listed.

 

I edited the data utility that generates the Task 'Subject' to find the workflow variables you listed and get their values.

My code appends the variables' <name> = <value> to the OOTB subject.

 

Seems to be bombproof. 😀

 

I can't read Polish so I don't know if the image below is exactly what you need but it does show that the workflow variables' values can be added to the Subject.

 

d_graham_0-1729704751493.png

 

David

Announcements

Top Tags