Using field names, field values, and expressions in workflow


When you are creating workflow, field references almost always refer to the Primary Form defined in the Associated Forms panel. This includes fields used in Execute On options and Run If actions. Fields to be used by workflow must exist on the Primary Form. Fields found on other associated forms are not displayed as selectable values in the field selection dialog for most workflow actions, or as part of the auto complete feature in qualification or field selector dialogs.

An exception to this is when a workflow action references a second form, such as Set Fields and Push Fields actions, where you can select fields from both the primary form and the secondary form, or an Open Window search action, where you might search for data in another form.

Mapping fields to values

Several workflow action types, including Open Window, Push Fields, Service, and Set Fields, allow you to transfer data between forms by using a field and value mapping. To do this, you use the field mapping table to select the appropriate fields and define the values to be assigned. 

Although the purpose of the field mapping varies according to the type of workflow action, the way you enter fields and values in the field mapping table is the same in each case. This section describes the general steps for mapping values to fields by using the field mapping table. 

The following figure shows an example of the field mapping table from a Set Fields action. In this example, the expression in the Value column defines the value to be set in the Short Description field by this Set Fields action. 

Example field mapping table

FieldMappingWidgetDS.gif

Tip

When editing a field mapping table, you can use the Tab key and arrow keys to move between cells in the table.

Selecting a field while defining workflow

To select a field from the list of all fields contained in the associated form, use the Field Selector dialog box, which is available in Developer Studio when you need to select a field while defining workflow. 

In the following figure, the Field Selector dialog box was opened from the active link Sample: Class Search in the AR System server sample application, so the associated form is the Sample:Classes form.

Field Selector dialog box

FieldSelectorDialogBox.gif

For a form that contains a large number of fields, you can use one of the methods in the Filtering Options or Available Fields areas to locate the appropriate field:

  • Name—To locate a field by name, begin to type the name in the Name field of the Field Selector dialog box. The list narrows to display only field names beginning with the characters you type.
  • Field Category—To locate a field by field type, select the check box for that type.
  • Locate—To locate the field name in the list while still displaying all the field names, begin to type the field name in Locate field.

To add a field to the table with the Field Selector dialog box

  1. Click in an empty row of the Field column.
    An ellipsis button appears.
  2. Click the ellipsis button.
  3. In the Field Selector dialog box, select the field to add to the field mapping table.
    The fields listed depend on the associated forms for the action and the type of mapping appropriate for the action.

Adding a value to the field mapping table

In the value column, you can enter a field name, keyword, static value, or expression. Use the expression editor select field names and keywords, or to create an expression. You can also type the expression in the field using the content assist feature.

To define a value for the field by using the expression editor

  1. After entering a field in the Field column, click the same row in the Value column.
  2. Click the ellipsis button that appears in the Value cell.
    The Expression Editor dialog box opens. The following figure shows an example of the Expression Editor dialog box in a Set Fields action, with a value being defined for the Short Description field. 

    FieldMappingExpressionEditDS.gif
  3. In the Expression Editor dialog box, build an expression to define the value:
    • To use a value from another field in the current request, select the field from the Available Fields list.
    • To use the current value of a keyword, select it from the Keywords list.
    • To set a static value in the field, enclose the value in quotes in the expression.
      For example, to set a field value that tracks what user modified the form and when, create an expression like the following:

      "Request modified by " + $USER$ + " on " + $Modified Date$ +"."

      In this example expression, "Request modified by " and " on " are static values,$USER$ is a AR System server keyword that contains the current user's login ID, and $Modified Date$ is a field in the current request. The "+" signs are operators that concatenate the parts of the expression.

    • In Set Fields, Service, and Push Fields actions, you can also use the results of data operations in the expression. For more information, see the descriptions of those workflow types in this document.
  4. When the expression is complete, click OK to close the Expression Editor dialog box and enter the expression in the field mapping table.

To define a value for the table by using the content assist feature

  1. After entering a field in the Field column, click the same row in the Value column.
  2. Begin typing the expression. For example, to select a field name, type a single quote (') or press Ctrl+Space.

    When you map fields, Developer Studio does not automatically validate the field types or prevent you from mapping fields of different types. If you map fields of different types to each other, AR System server converts the values at runtime.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*