In some cases, you may want to set a variable in a scenario and then reference the variable in the body of an e-mail message that the scenario sends out (using either the EmailNotify or the SendEmail action). In the following example, you set up a scenario that watches for a customer to make a purchase, tracks the order ID in a variable called orderNumber and the date the order was placed in a variable called orderDate, and then sends the customer an e-mail that includes both pieces of information. The scenario includes the following elements:

You could then add the following lines to the email template orderreceived.jsp:

<p>Order number
<dsp:valueof param="context.processInstance.contextStrings.orderNumber"/>
<p>was received on
<dsp:valueof param="context.processInstance.contextDates.orderDate"/>

Here is the same example in JHTML:

<p>Order number
<valueof param="context.processInstance.contextStrings.orderNumber"></valueof>
<p>was received on
<valueof param="context.processInstance.contextDates.orderDate"></valueof>

(Note: The context variable is bound to the template at runtime, so the value of the variable does not appear if you simply preview the template in a Web browser, for example by using the preview features in the ACC. If you want to make sure that the correct values appear, set up a test e-mail address and send the message to it.)

The valueof tag references the process execution context, an implementation of the interface processExecutionContext that extends the atg.process package. The following properties of the context component are available for use in the e-mail template:

The page compiler uses Dynamic Beans to reference subproperties of these context elements. In the example above, contextStrings and contextDate are subproperties of the processInstance. Other processInstance subproperties that you can reference in this way are as follows:

For more information on Dynamic Beans, refer to the ATG Programming Guide.

loading table of contents...