Custom Code Action

Written By Lu Benavides (Collaborator)

Updated at August 30th, 2024

There's a lot your workflows can do for you, from automating responses to handling payments to making sure your team is reminded of what to do next. However, the list of actions, even when always growing, can be a bit limiting. Have you ever wanted to do more with your workflows than what is set up already? With Custom Code Action you can!

Adding Custom Code

Click the + button and add the action, it will be under your Internal Tools but you can also look it up.

The programming language will be JavaScript.
 

If there are custom values that you want to add, "Property to be included in code” is the place they belong in. If you have more than two needed custom values click +Add Property to get more fields.

In Code you will find the code formatted, a box where you can write your code, it is prepopulated with a sample code for reference. Please remember that the output should be a JavaScript Object or Array of Objects.

Adding HTTPS Requests.

External HTTP Requests in Custom Code quickly add your preferred HTTP Method without the need to type in all that information, this option is available to you at the top of the code box.

Once you click it you can select from preset HTTP Methods from a dropdown menu.

This will populate the code needed for that action at the bottom of the editor.

Testing Your Code

Once your code is fully written click the Run test button, this is an obligatory step. If there is an error in the code then the result will be "Test Result Failed", in this case, recheck the code and remove the error. The system will let you know where the error is located for easier correction.

If there are no errors in the code it will show “Test Result Success” and give you an output. Once that happens you can save the action.

Now you can access your custom values in any text to add them, all custom code outputs will be in the same section, look for the one whose name matches the action name.

Important notes:

  • Custom values, except contact information, will not be passed when testing your code.
  • Use the Property fields to assign key names and map values from previous steps.