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

Change Object number in Workflow task notification subject

  • February 22, 2012
  • 13 replies
  • 11503 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

1-Visitor
February 22, 2012
Hi Prathap

educated guess: From the start transition tab, programmatically alter the
assigned activity name. That should be reflected in the email subject.





Thank you and have a great time.

Best Regards

Swamy Senthil

Principal Solutions Architect, Swasen Inc

swamy.senthil@swasen.com(Email); 909 800 8423(M); 973 324 2729(W); 866
908 6561(F);




1-Visitor
February 22, 2012
The following example might work well for you in the start transition of
your activity.



//Define the Activity Name

String ecnNumber =
((wt.change2.WTChangeOrder2)primaryBusinessObject).getNumber();

String MyActivityName = "Analyze Change Notice " + ecnNumber



//Set the Name

wt.workflow.engine.WfActivity myActivity =
(wt.workflow.engine.WfActivity)self.getObject();

myActivity.setName (MyActivityName);

myActivity = (wt.workflow.engine.WfActivity)
wt.fc.PersistenceHelper.manager.save(myActivity);




1-Visitor
February 23, 2012

You need to modify the activity in the start transition and persist/modify it. The email notification OOTB takes care of the rest.

I got this code stuffed somewhere and searching this solutions blaster for old posts would likely turn it up.

Hey PTC, has no one ever asked for this in a enhancement request? No BOCA requests? I always seem to have to implement this eventually or find it previously implemented.






Sent from my Verizon Wireless BlackBerry
1-Visitor
February 23, 2012
Thanks David. I agree with you that this should be OOTB feature rather than
customization.
I am thinking of writing a listener event on WfProcess object and update
all the WfAssignedActivity names to append change object number. That way I
don't have to update all the workflows and new workflows will automatically
get that feature.



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



1-Visitor
February 23, 2012
Listeners are expensive on performance, not foolproof. Better off writing a queue with a single entry that runs and reschedules. I would also update the existing templates with this. If you have a lot, may find SQL handy to update them. It isn't as scary as it sounds.

Another option could be a stored procedure in the database.





Sent from my Verizon Wireless BlackBerry
12-Amethyst
February 23, 2012
We have a much different experience with listeners. We find our part and
document listeners to not have a negative performance impact, whereas we
found that relying on workflow queue entries inevitably fail after enough
years of running with tens of thousands of objects. Moreover, we often
need real time updates based on user transactions with as little impact to
out of the box code as possible - and listeners do that since they do not
impact the user interface and are segregated form the main codebase. For
example, we use a listener service to rename parts automatically based on
PartsLink classification naming rules - it executes on create, revise,
save as, check out, and check in. It works very well - much better than
if we had relied on workflows, for example, or some other asynchronous
queuing method.

For this particular issue on the worklist, it is fairly easy to create
your own column on a worklist. It is a very lightweight enhancement, and
you can put anything you want in your own column. For example, we have a
column called "Parent ECN for ECT Only" that lists the ECN number and link
to the ECN on an ECT task on the worklist (it displays "-" for other
tasks). We added a few other columns, as well. While this is a
customization, we have found it to be easy enough to maintain from upgrade
to upgrade to make the benefit worth the incremental cost added to our
upgrades to regression test those columns.

On the other hand, if every assigned activity needs the primary business
object number appended to the task name, you might just use a few lines of
code in the activity Start transition in the workflow template to change
the activity name if it isn't already changed. That should be even easier
to make than a listener or a new column on a worklist, assuming that the
activity is persisted by the time the start transition executes (I think
it is, but haven't tried it).

Al Anderson



1-Visitor
February 23, 2012
Well I never suggested a solution that changes OOTB interface.

Not to get too much of a tangent, I stated only ever one entry in the queue. That entry executing code to look for workitems/activities matching desired criteria. In addition, I have no clue why a queue would grow so big, entries should be removed upon completion. It's not meant as a way to audit.

Lastly, since everyone's setups are different, and some are quick to add a listener for this or that, poorly code them, you can degrade the system. I mainly point out these points to make anyone objectively think about solution architecture, not to avoid event listeners altogether.

For example, I have a single listener that runs and monitors all events, a properties file then contractually is run at server startup to seed what helper classes have subscribed to an event.




Sent from my Verizon Wireless BlackBerry
22-Sapphire I
February 23, 2012
We include the PBO Number in front of the assignment Name dynamically, as shown here (rather than including the subject). This number carries thru related emails. It's also very helpful because all reporting on completed assignments (tasks) can be filtered by the type of object.
[cid:image001.png@01CCF183.478D8AD0]
1-Visitor
February 23, 2012
Thanks Mike this the solution I was referring to.


Sent from my Verizon Wireless BlackBerry
13-Aquamarine
November 21, 2014

Hi Mike,


I know this is an old post but, how did you add the ECN number to the front of the Workflow Task name? I tried to add {primaryBusinessObject} to the Name field of the Activity node but that didn't work.