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
I've read the help and old posts from 2013 on this topic. I can see that this uses the old template processors and the developer is 8 years retired to Shangri-La. So who here has mucked with this? Users are asking for some basics for both workflow task emails and notification emails:
Windchill help has this confusing verbiage about "Subject" templates. What the heck is that? Does this pick a template based on the task name? Who wrote this?
Lastly, is there a complete listing of all possible methods that can be called? It might be worth it to extend it and add more custom methods for more functionality. Windchill 11.1 BTW.
Solved! Go to Solution.
"You fargin' ....!" I will skip the swearing but if you get the reference, you know where I am at. Well, this has been a frustrating adventure but I would I would summarize what I found so that you do not need to go dumpster diving again. TL/DR - If PTC does not want to enhance workflow task emails, update your docs to indicate the limits of configuration possible so that customers do not bang their heads against the wall.
Let's start with the basics. Below is an OOTB user task email message. I am not going to discuss notification emails which are more configurable, just ones delivered from user assignment tasks.
Here is a list of help docs, articles and other posting I found on topic.
Indicates ability to include variables in instructions. PBO would appear as a hyper link.
This would be a low code approach.
https://www.ptc.com/en/support/article/CS151717
This works to change the subject or task name at start of assignment. This could make sorting tasks in tables difficult relying on prefixing.
Motherload of information: Kudos to @TomU !!!!
https://www.ptc.com/en/support/article/CS94124?language=en&posno=1&q=beginSubject&source=search
This indicates that the supported method is possible in templates without coding. Changing the subject!!
Here is what I learned from turning on logging and Eclipse:
Still here? Thanks for reading. I do know of some other tricks here but I would not recommend. One is turning off send notification flag in task and generating your own email (which you would have control over the template) but that is overkill here. PTC really needs to ditch template processors OR provide users with the flexibility to alter as it was designed to do. Simply make a look up to a properties file where we can change the HTML template and processor if we like. Bare minimum would be document what users and tech support have compiled. Best would be to include those enhancements. Remember, this is what the casual user sees as their first introduction to Windchill. <end of rant>
The easiest way I know to customize the subject of the email is to rename the assigned activity with some code in the activity's start transition. As an example see https://www.ptc.com/en/support/article/CS151717. That's usually as far as I go customizing the notification. To me the email doesn't matter much. I prefer to just customize the task completion page using the templates through the UI. You can create custom html templates for email in <Windchill_home>\codebase\templates\workNotification and use them in a notify-by-email node in the workflow but that gets to be too much to implement and maintain.
I think changing the WfAssignedActivity name runtime is a crazy hack, and more so to solve an e-mail notification requirement.
E-mail robots do use the templates that can be customized in terms of attributes. Work Notification e-mails (when workitems are assigned) have a single template processing method that generates all the attributes in the e-mail (hard-coded).
For any serious e-mail customization until template processing is thrown out, you may have to write your own notification system based on event listeners and mail APIs (java or IE).
"You fargin' ....!" I will skip the swearing but if you get the reference, you know where I am at. Well, this has been a frustrating adventure but I would I would summarize what I found so that you do not need to go dumpster diving again. TL/DR - If PTC does not want to enhance workflow task emails, update your docs to indicate the limits of configuration possible so that customers do not bang their heads against the wall.
Let's start with the basics. Below is an OOTB user task email message. I am not going to discuss notification emails which are more configurable, just ones delivered from user assignment tasks.
Here is a list of help docs, articles and other posting I found on topic.
Indicates ability to include variables in instructions. PBO would appear as a hyper link.
This would be a low code approach.
https://www.ptc.com/en/support/article/CS151717
This works to change the subject or task name at start of assignment. This could make sorting tasks in tables difficult relying on prefixing.
Motherload of information: Kudos to @TomU !!!!
https://www.ptc.com/en/support/article/CS94124?language=en&posno=1&q=beginSubject&source=search
This indicates that the supported method is possible in templates without coding. Changing the subject!!
Here is what I learned from turning on logging and Eclipse:
Still here? Thanks for reading. I do know of some other tricks here but I would not recommend. One is turning off send notification flag in task and generating your own email (which you would have control over the template) but that is overkill here. PTC really needs to ditch template processors OR provide users with the flexibility to alter as it was designed to do. Simply make a look up to a properties file where we can change the HTML template and processor if we like. Bare minimum would be document what users and tech support have compiled. Best would be to include those enhancements. Remember, this is what the casual user sees as their first introduction to Windchill. <end of rant>
Just a follow up tip since I rolled out changes today. I used an expression robot to gather attributes like Change Notice description to throw into emails. Careful to check for null values. In fact, ensure that all displayed values have some value that's not null. The result will be a NullPointerException calling the value in the email template and the result will be an email with no body. And its too far past Halloween for that.