Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
Thank you in advance for any advice.
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,
@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.
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
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
@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.
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)
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,
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.
David