Adding arguments for Code Actions

You can add function arguments to make code actions reusable. Additionally, you can implement multiple arguments for a single cloud action by adding parameters and values for the same action.

Arguments in Code Action

Arguments in Code Action


Rules for adding the arguments

Each rule, along with its description, is given below:

RuleDescription
Data typeA code action argument should always be a string.
Argument namesArgument names should be validated. An argument name must comply with JavaScript naming.
Number of ArgumentsThe maximum number of arguments is 30.
TitleThe title should be unique for each Reply Action. The maximum length of the title is 30 characters.
Value LimitThe Maximum limit for the value is 5000. The payload.args object is {} (empty) by default. This prevents additional null checks.

Adding Arguments to the Code Action

To add multiple arguments:

  1. Select ACTION to trigger the Reply Action.
  2. Select the applicable action from the Choose the action drop-down menu.
    Note: You cannot add Arguments for Webhooks.
  3. Select EDIT to add the arguments.
  4. Select ADD ARGUMENT.
  5. In the ARGUMENTS, enter the Title and Value.
  6. Select the Required check box to make this argument a mandatory field.
  7. Select ADD ARGUMENT to add multiple arguments.
  8. Select SAVE to update the arguments.

Example

As an example, we created a flow to buy a product like the iPhone. You can add multiple iPhone models as arguments in the code action.

When you configure a Code Action argument, it is available on execution inside the code action within the payload.args object.

The example action code is given below: