Add an expression step to the method flow
The expression step enables you to insert an expression as a distinct step in the method flow. The step accepts inputs from the flow steps preceding it, applies business logic implemented as a JavaScript function on the input values, and outputs the outcome to the next step in the flow.
In this example, the open-account method accepts a customer name and returns a success message after the account is created. The expression step transforms the structure type field that contains the customer name into a string type field.
In the example, the Input step fields are mapped to the Expression step fields.
To add an expression step to the method flow, perform the following:
- Place the expression element in the flow after the element that provides input to the expression.
In the example, the Expression step is placed after the Input step. However, it's possible to place it after any other step except the Output step.
- Click Input on the Expression step and set the expression input field.
In the example, the expression input is the structure-type fullName field comprised of firstName and lastName.
- Click Logic on the Expression step to set the expression logic. Then, use a JavaScript function to define the manipulation performed on the input value and click Save.
In the example, the javascript function concatenates firstName and lastName to a single string.
See JS function templates for different business logic expressions demonstrating the transformation syntax between the different field types.
- Click Output on the Expression step and set the expression output.
In the example, the expression step output is the string-type fullName field that accepts the value returned by the expression function defined in the Business Logic box.
- Click the expression step input mapper and map the expression input fields to the preceding step fields.
In the example, the Input step fields are mapped to the Expression step fields.
- Click the expression step output mapper and map the expression output fields to the fields of the following step.
In the example, the expression step output fields are mapped to the Oactcs9 asset input fields.
- Click Close.
Updated 4 months ago