I am attempting to create my own custom workflow email notification template and I'm confused about the right way to use methods for dynamic text inside the template. In the help documentation it show the methods inside (what I think are) comments. For example:
-----------------------------------------------------------------------------
<SCRIPT LANGUAGE=Windchill>
<!-- getPrimaryBusinessObjectName -->
</SCRIPT>
-----------------------------------------------------------------------------
However looking in the existing email templates I'm seeing a mix. Some items are inside comments and others are not.
-----------------------------------------------------------------------------
Activity Description: <SCRIPT LANGUAGE=Windchill> <!-- activityDescriptionPlain --> </SCRIPT>
Business Object: <SCRIPT LANGUAGE=Windchill> <!-- primaryBusinessObjectLinkPlain --> </SCRIPT>
Go to Process Manager: <SCRIPT LANGUAGE=Windchill> getProcessManagerURLPlain </SCRIPT>
-----------------------------------------------------------------------------
<SCRIPT language=Windchill>getLocalizedMessage resourceKey=SUB_OBJ resourceClass=wt.workflow.work.workResource</SCRIPT>
<SCRIPT LANGUAGE=Windchill> <!-- primaryBusinessObjectLink --> </SCRIPT>
-----------------------------------------------------------------------------
What is the right way? How do I know if something is supposed to be inside a comment block or not? Does it even matter?
Thanks!
You're having a journey to the past 🙂
This is the first mechanism to do dynamic HTML in Windchill, before JSP and others.
Each HTML file is associated to a java class in a propertiy file, like :
wt.services/rsc/default/wt.templateutil.DefaultHTMLTemplate/CONTAINERMOVE/java.lang.Object/0=templates.htmlcomp.wizard.WizardExt
wt.services/svc/default/wt.enterprise.TemplateProcessor/CONTAINERMOVE/java.lang.Object/0=wt.dataops.containermove.processors.MoveWizardTemplateProcessor/duplicate
The file codebase/templates/htmlcomp/wizard/WizardExt.html is associated to wt.dataops.containermove.processors.MoveWizardTemplateProcessor
A comment embedded in the tag script with the langage Windchill is processed, an a static method is called on the processor class:
<SCRIPT LANGUAGE=Windchill>
<!-- getPrimaryBusinessObjectName -->
</SCRIPT>
These methods have a signature like this one :
public void displayAssociatedOCE(Properties parameters, Locale locale, OutputStream os)
throws WTException {
PrintWriter out = getPrintWriter(os, locale);
...
}
And the printwriter is used to create HTML
It can be compared to a tool like The Apache Velocity Project