Setting up Dynamic Data Inputs to an Email Message

Data fields available to the process can be used to dynamically set parts of the email at runtime, using either %FieldName% notation or the Select Data Field or Formal Parameter dialog.

See Defining an E-Mail Service Type from a Service Task.

However, a process formal parameter, or a package-level or process-level data field that is defined as an external reference to an attribute of a class defined in a business object model (that is, as structured data), cannot be used in this way.

Procedure

  1. Create an activity-level data field on the Data Fields tab of the email service task. The data field:
    • must be defined as a simple type that matches the type of the attribute you want to reference.
    • must not have the same name as an existing formal parameter, or package-level or process-level data field.
  2. On the Scripts tab, define an Initiate Script (of type JavaScript) to assign the value defined in the desired attribute to the data field.
    Note: The attribute must have been populated earlier in the process - for example:
    • by passing the data into the process from an external source, using a message start event, a receive task or a catch message intermediate event. See Exposing a Web Service .
    • by collecting the data on a form. See "Associating Process Data with Events and Tasks" in TIBCO Business Studio Modeling Guide.
    • in a script, using a dynamically created factory method to create a new data object from the attribute’s parent class. See Dynamically Created Factory Methods .
  3. On the General or E-Mail tab, enter the local data field name at the appropriate place, using either %FieldName% notation or the Select Data Field or Formal Parameter dialog (as described in Defining an E-Mail Service Type from a Service Task).