Adding a Function component
1. Click on a Virtual Agent model and select Automation Designer .
2. You will be taken to the Automation Designer inside the Builder app, where the flow configuration will take place.
3. Under “Automation”, select the Function component  and then drag it to a canvas on your right side .
4. Double-click the component. Then, the component settings panel  will appear.
5. Provide the required details of the component.
- “Component name” : The name of the Function component. The name can only contain letters, numbers (except as a first character), and underscores, and can be as long as 30 characters.
- Context.getVariable(variable name): Get value from a variable. This method allows getting the Virtual Agent’s variable data so that you are able to use those values in the logic execution previously defined.
- Context.setVariable(variable name, new value): Define the value of a custom variable. This method allows you to set the Virtual Agent’s variable data so that you are able to execute the logic that you previously defined, and store the transformed data into a VA’s variable. Note: The system’s variable values cannot be changed (e.g. the utterance, caller ID, and confidence score).
- The code editor has 20 lines by default and will increase in height if you keep editing below, with the scroll on the side.
- There is a limit of 3000 characters and another for an execution timeout of 2 seconds, meaning that if you have code exceeding 2 seconds of running time, the code will stop running and the component will move with the error exit.
6. Click Save .
After the component is created, you can connect it with another component: One for “Success” and another for an “Error” scenario. Keep in mind that if the component is not directly or indirectly connected to a Flow Trigger component, it will be ignored when the flow is executed.
Note: A red exclamation mark will appear on the component node if any required field is invalid. Hold the pointer over it to see further details.
Deleting a Function Component
1. On your canvas, click the Function component you want to delete, and then press the backspace key (Windows) or the delete key (Mac) on your keyboard. Alternatively, you can double-click the component and select Delete in the side panel that appears.
2. Click Delete component in the dialog that appears to confirm the deletion.