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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Workflow Task Notifcation Questions

TomU
23-Emerald IV

Workflow Task Notifcation Questions

I am working on customizing the workflow task notication templates and have a few questions.

 

1.)  Why does the activityNoficationURL method not get put in comments but all of the other methods do?  (It will fail if placed in comments.)  [Red Box]

 

2.)  Where is the extra condition "notification" for activityAttributes documented.  [Blue Box]

 

Workflow Task Template 01.png

 

3.)  How do I get just the task URL without all of the extra garbage?  [Orange Boxes]

Workflow Task Template 02.png

 

4.)  Why does the task list the process name instead of the task name?  Is this controlled by a preference?  If not, can the process name itself be changed?  (I'm already dynamically changing the task name.)

 

Workflow Task Template 03.png

 

Thanks!

11 REPLIES 11
HerwigSchwarz
12-Amethyst
(To:TomU)

Haha, I was about to ask nearly exactly the same questions.

 

I usually switch to "notification=true" now because it is missing this stupid hyperlink to the workflow process, which is usually confusing the assignee.

What a shame one can't configure the text properly.

 

But further below that block I put all the really interesting stuff for the customer. Using getActivityVariable varName="messageBody". The variable messageBody can be created in each workflow task differently.

If the variable is not there at all no excpetion is thrown, it is just left blank in the mail.

 

 

avillanueva
22-Sapphire II
(To:TomU)

Its been a while since I used template processors. Did you overwrite the PTC supplied processor or did you create your own? Those other method calls, are those yours or are they part of the PTC default.  Where is the template processor called out? which property file?

TomU
23-Emerald IV
(To:avillanueva)

I'm afraid I don't know anything about template processors.  I was just modifying the templates here:

  • Windchill\codebase\templates\workflow
  • Windchill\codebase\templates\workNotification

The help documentation talks about how to do this:

http://support.ptc.com/help/windchill/whc/whc_en/#page/Windchill_Help_Center%2FWCCG_BusLogicCust_WorkflowAdmin_EmailNotif.html

 

As far as renaming the promotion request and the tasks, I'm doing that in the workflow itself:

// get promotion request attributes
number = ((wt.maturity.PromotionNotice)primaryBusinessObject).getNumber().toString();
// change name of promotion request wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject; wt.maturity.PromotionNoticeIdentity promotionNoticeIdentity = (wt.maturity.PromotionNoticeIdentity) pn.getIdentificationObject(); promotionNoticeIdentity.setName("Promotion Request " + number); wt.fc.IdentityHelper.service.changeIdentity(pn, promotionNoticeIdentity);
// rename task
wt.workflow.engine.WfActivity myActivity = (wt.workflow.engine.WfActivity)self.getObject();
myActivity.setName("PR-" + number + " Design Check");
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);

(Both of these code blocks were copied from other community posts.)

avillanueva
22-Sapphire II
(To:TomU)

I do, it starting to come back. The class that generates the email is wt.workflow.worklist.WfTaskNotificationProcessor, called out in service.properties files. This has all the methods that the PTC help document specified.  They are all public methods that take in parameters, local and an output stream. They create a string and pass the local, the output stream and the string to a processValues method.

 

So, if I cannot make do with the OOTB methods, I can extend their class and write my own. I would need to replace their method in the service.properties file and it should run all of the OOTB method plus any custom ones I created. 

 

Users simply want to be able to look at the email and know if they need to take action without having to log in. The issue is made even worse when the task gets completed by another user, navigating to the task gives you the not found error message. I would pay hard cash to someone who fixes that. Either way, I can create an alternate link so if that link is gone, they can still find out what the hubbub was all about. 

James62
12-Amethyst
(To:TomU)

Don't have any answer. I was just trying to add special instructions, cause regular instructions field is limited by 4k characters.

 

Only here to say that this is horrible, really horrible. How am I supposed to translate the labels and change 'Due Date' to DD.MM.YYYY format?

 

General_en_US.html

<html>
<!-- bcwti
  --
  -- Copyright (c) 1997, 1998 Windchill Technology, Inc.  All Rights Reserved.
  --
  -- This software is the confidential and proprietary information of
  -- Windchill Technology.  You shall not disclose such confidential information
  -- and shall use it only in accordance with the terms of the license
  -- agreement you entered into with Windchill Technology.
  --
  -- ecwti
  -->
<SCRIPT LANGUAGE=Windchill> <!-- beginSubject --> </SCRIPT>
<SCRIPT LANGUAGE=Windchill> <!-- getActivityName --> </SCRIPT>
<SCRIPT LANGUAGE=Windchill> <!-- addText text=" - " --> </SCRIPT>
<SCRIPT LANGUAGE=Windchill> <!-- getPrimaryBusinessObjectName --> </SCRIPT>
<SCRIPT LANGUAGE=Windchill> <!-- endSubject --> </SCRIPT>
<head>
     <SCRIPT LANGUAGE=Windchill>
        <!--
          getStyleSheetProps
        -->
   </SCRIPT>
</head>

<font face="Arial, Helvetica, sans-serif">
<SCRIPT LANGUAGE=Windchill> activityNotificationUrl </SCRIPT>
</font>

<hr size="1" color="#40637A">
<font face="Arial, Helvetica, sans-serif">
<SCRIPT LANGUAGE=Windchill> <!-- activityAttributes --> </SCRIPT>
</font>

<hr size="1" color="#40637A">
<BR>
<table border="0" cellpadding="3" cellspacing="0" style="font-size: 0.9em;">
<tr><td align="left" valign="top" nowrap><font face="Arial, Helvetica, sans-serif"><b>
Special instructions:&nbsp;
</b></font></td></tr><tr>
<td align="left" valign="top"><font face="Arial, Helvetica, sans-serif">
<SCRIPT LANGUAGE=Windchill> <!-- getProcessVariable varName="special_instructions" --> </SCRIPT>
</font></td></tr>
</font>

</body>
</html>

 

Result:

wch_email_1.PNG

TomU
23-Emerald IV
(To:James62)

I think you'd have to either turn off that section and build your own (another workflow variable) or possibly do like Antonio suggested and build your own template processor. Either way, it's very difficult to customize these email notifications.


James62
12-Amethyst
(To:TomU)

Hi Tom,

 

Thanks for the reply. I'm not really sure about the template processor approach. I've tried to look at the class wt.workflow.worklist.WfTaskNotificationProcessor with Eclipse, but it doesn't expose anything usefull.

 

task_processor.PNG

 

No clue where to look for service.properties mentioned by @avillanueva.

 

Additional workflow global variable is out of question. The infomation needed is already there with the workflow object. I don't see any good reason to copy it into a global var, it only makes things too complicated, especially in cases where writing to a workflow global var simply fails.

 

Btw, what i also found out is, when the workflow global var retrieved in General_en_US.html using getProcessVariable is null, then the e-mail task notification sent to the user is completely blank. It gets sent with the subject of the email and nothing else.

 

TomU
23-Emerald IV
(To:James62)


Btw, what i also found out is, when the workflow global var retrieved in General_en_US.html using getProcessVariable is null, then the e-mail task notification sent to the user is completely blank. It gets sent with the subject of the email and nothing else.


It gets worse.  Some of the variables have to be called together and in a specific order or they don't work.  I went round and round with PTC and asked them to document this but they wouldn't.  They claimed there was no way to create a document generic enough to be relevant to all customers.  Seems like people would want to know why certain methods only work half the time...

 

Here's a bit of the conversation between the tech and R&D:

Why do we have such behavior?
-->This is the intended behavior as "getDeadline" sets certain values which are being used in "getOverdueTaskRow" and "getOwnerRole"

Are there certain methods that can only be called after other methods are called first?
--> Yes it has to follow this sequence

Any other workaround or solution for the use case?
--> As a workaround please use style="display:none;" property with the first call and then again call this as and when needed without this property.

 

This probably warrants a separate thread, but I've started putting together a matrix of variables and where they can be used.  This first one is derived from the out of the box email templates and the second is based on the help documentation.

 

Workflow Template Variables.PNGEmail Template Variables - Help Docs.PNG

 

By the way, don't try to use any of the stuff in the "plain" templates.  They aren't used anymore and the calls in them aren't valid.  Article CS293803 was the result of that conversation.

 

James62
12-Amethyst
(To:TomU)

Nice, Tom. Thanks for taking the time to write this up. It's a great deal of work. I'd have never figured out tenth of this much.

 

I'd be ok with simple getInstructions() method off of the wt.workflow.work.WfAssignedActivity instance, but I'm simple minded, straight to the point kind of person, you know. That doesn't fit well with PTC's way of thinking. Looking at the Windchill api docs now, WfAssignedActivity isn't even there. For me, it's no surprise that some really important subjects are not documented at all.

 

I remember years back when I was dealing with ProE/Creo. It really looked like PTC was loosing the grip on their own product, not knowing how to help. Their support people sometime had absolutely no idea. Now comes the same period for Windchill.

 

My opinion is that this matter of workflow notifications is important for every single customer that uses the full-blown Windchill PDMLink. There are two main reasons to use this software, workflows is one of them. The ability to customize these messages in straightforward and understandable manner is crucial.

 

As far as the template processor approach goes, the only thing i found is this response https://community.ptc.com/t5/Windchill/Has-anyone-tried-overriding-Windchill-workflow-email/m-p/368091/highlight/true#M56745

It seems like it's something that is supposed to be phased out in newer releases of Windchill, but I don't know. The problem is, I'm not really getting any clue as to how it works from just that post there.

 

 

Zoltán
13-Aquamarine
(To:James62)

Feels like nobody gets solutions from PTC documentation.  😕

HelesicPetr
22-Sapphire I
(To:Zoltán)

Hi @Zoltán 

PTC documentation does not provide that solution.

PetrH

Announcements

Top Tags