Using field names, field values, and expressions in workflow
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
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
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
- Click in an empty row of the Field column.
An ellipsis button appears. - Click the ellipsis button.
- 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
- After entering a field in the Field column, click the same row in the Value column.
- 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. - 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.
- 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
- After entering a field in the Field column, click the same row in the Value column.
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.