NotificationTemplate Class Methods
In this section, we discuss the NotificationTemplate class methods. The methods are discussed in alphabetical order.
Syntax
GetAndExpandTemplate(Language, Vars)
Description
Use the GetAndExpandTemplate method to expand and map the variables into the Text property of the template.
If this is a component template, you must use the SetupCompVarsAndRcpts method first, before you use this method.
If this is a generic template, you must use the SetupGenericVars method first, before you use this method.
The value returned by the Setup methods must be used as the second parameter for this method.
Parameters
Field or Control |
Definition |
---|---|
Language |
Specify the 3-character language code used with the notification. |
Vars |
Specify the variable representing the XML string returned by either the SetupCompVarsAndRcpts method or the SetupGenericVars method. |
Returns
Returns a Boolean value: True if the template expanded properly, False otherwise.
Example
import PT_WF_NOTIFICATION:NotificationTemplate;
Local NotificationTemplate & mynotifytemplate;
&mynotifytemplate = create NotificationTemplate(%Component, %Market, &templateName, "C");
&xmlVars = &mynotifytemplate.SetupCompVarsAndRcpts(GetLevel0());
&mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);
Syntax
SetupCompVarsAndRcpts(&Rowset_Context)
Description
Use the SetupCompVarsAndRcpts method to set up variables for the component from the provided rowset. This method also sets up any additional recipients defined in the component.
The rowset corresponds to the component that the notification template was instantiated with. For example, if you created a notification template for JOB, the rowset used with this method should be based on the JOB component.
If you want to expand a component template, you must use this method first, before expanding the template.
Parameters
Field or Control |
Definition |
---|---|
&Rowset_Context |
Specify an already instantiated and populated rowset containing the necessary variables. |
Returns
A string containing XML that is used by the GetAndExpandTemplate method.
Example
import PT_WF_NOTIFICATION:NotificationTemplate;
Local NotificationTemplate & mynotifytemplate;
&mynotifytemplate = create NotificationTemplate(%Component, %Market, &templateName, "C");
&xmlVars = &mynotifytemplate.SetupCompVarsAndRcpts(GetLevel0());
&mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);
Syntax
SetupCompVarsAndRcptsLevel1(&Rowset_Context, row_num)
Description
Use the SetupCompVarsAndRcpts method to set up variables for the component from the provided rowset. This method also sets up any additional recipients defined in the component.
The rowset corresponds to the component that the notification template was instantiated with. For example, if you created a notification template for JOB, the rowset used with this method should be based on the JOB component.
If you want to expand a component template, you must use this method first, before expanding the template.
Parameters
Field or Control |
Definition |
---|---|
&Rowset_Context |
Specify an already instantiated and populated Rowset object containing the necessary variables. |
row_num |
Specify the row number as a number value. |
Returns
A string containing XML that is used by the GetAndExpandTemplate method.
Syntax
SetupGenericVars(&AryValues)
Description
Use the SetupGenericVars method to pass values to a generic template.
To expand a generic template, you must use this method first, before expanding the template.
Parameters
Field or Control |
Definition |
---|---|
&AryValues |
Specify an array of string containing values used with the expanded template. |
Returns
A string containing XML that is used by the GetAndExpandTemplate method.
Example
import PT_WF_NOTIFICATION:NotificationTemplate;
. . .
&mynotifytemplate = create NotificationTemplate("","", "MYTEMPLATE", "G");
/* Populate an array to contain the values needed by */
/* the template */
&aryValues = CreateArrayRept("", 0);
&aryValues.Push("FIRST VALUE");
&aryValues.Push("SECOND VALUE");
&xmlVars = &mynotifytemplate.SetupGenericVars(&aryValues);
&mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars);