Skip to main content
1-Visitor
February 22, 2012
Question

Change Object number in Workflow task notification subject

  • February 22, 2012
  • 13 replies
  • 11508 views
Hi all,
We are using Windchill 9.1. OOTB email notifications for the
workflow task notifications have generic subject with Activity name such
'Approve task' , 'Review task'.
I am trying to find a way to add the ECR/ECN number to the subject such as
'ECR-1234 Approve task', 'ECN-2345 Review task'. I am wondering if there
is any way of extending notification processors and add this to all the
tasks.
Any pointers will be helpful.


Thanks,
Prathap <">http://goo.gl/LuT5>

13 replies

13-Aquamarine
November 21, 2014
Perfect, thanks Steve. When I looked at the post on the forum I couldn’t see the code for some reason.

Patrick Williams | Engineering Systems | c: 616.947.2110
[cid:image001.jpg@01D0057C.01F45DE0]
1-Visitor
November 21, 2014
Hi guys, here is the code I’ve used. It includes the prefix check (I may have my nomenclature backwards) to ensure it doesn’t duplicate the loop. Note this code adds the activity number to the end of the task.

If you enter this code into the “Start” transition of an ECR task it will append the Number of the ECR to the Activity name and subsequent email notifications and of course the tasks themselves. It must be tailored slightly to fit other workflow objects such as ECN’s or Problem reports. See examples below:

CODE:
// This code snippet is object specific and gets the number of the object and assigns it to the string number
java.lang.String number = ((wt.change2.WTChangeRequest2)primaryBusinessObject).getNumber();

// You can use the following instead of the line above for other objects
//= ((wt.change2.WTChangeRequest2)primaryBusinessObject).getNumber();
// = ((wt.change2.WTChangeOrder2)primaryBusinessObject).getNumber();
// = ((wt.change2.WTChangeActivity2)primaryBusinessObject).getNumber();
// =((wt.change2.WTVariance)primaryBusinessObject).getNumber();
// =((wt.change2.WTChangeIssue)primaryBusinessObject).getNumber();


wt.workflow.engine.WfActivity myActivity =(wt.workflow.engine.WfActivity)self.getObject();
String prefix=myActivity.getName();
if (!prefix.endsWith(number)) {
java.lang.String Activity_Name = prefix + ": " + number;
myActivity.setName (Activity_Name);
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
}

NOTIFICATION EMAIL:
[cid:image001.png@01CDFE17.241F33E0]
1-Visitor
November 25, 2014
Steve,
I have been trying to get your code to work and I keep getting a stalled queue error when the task tries to start.
I too am trying to get the ECN number appended to the Change activity work flow task so the user know which ECN he is dealing with.
I thought I needed to added the variables to the workflow and the task, but that was not it. I believe the Start transition is seeing false and the task will not start.
Was there anything else you need to setup?
Thanks in advance for any help,

[UTC BIS_RGB-sml]
Ray Drennen
Technology, Components, & Methods Group – Engineering Systems

5 Farm Springs Rd.
Farmington, CT 06032
860-676-5619 - voice
860-353-1356 – eFax



1-Visitor
December 16, 2015

Hi Raymond,

My client having similar type requirement and have tried the above code for WTDocument Type, however while executing the Check Syntax, Its giving errors,

Kindly help me out to execute the same.

Do i need to create *.java file to execute the above code?

Thanks in advance.

Regards,

Mahesh Kumar G

15-Moonstone
December 17, 2015

Mahesh Kumar G‌,

What is the code that you're using to give you syntax errors?  Can you post the code?