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.
📌NOTE: This is a Premium Action.
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.
The Custom Code Action empowers you to enhance your workflows by adding tailored functionality, automating complex processes, and integrating external data. With its flexibility and testing capabilities, you can push past limitations and create solutions uniquely suited to your needs. It's the key to unlocking advanced workflow automation with ease.
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.
FAQs
Q: Do I need to be a programmer to use the Custom Code Action?
- A: Basic knowledge of JavaScript is recommended, but the feature provides sample code and preset HTTP methods to help you get started.
Q: What happens if I encounter an error while testing the code?
- A: The system will indicate where the error is located, allowing you to troubleshoot and fix it. You must resolve all errors before saving the action.
Q: Can I use Custom Code to pull data from external sources?
- A: Yes! You can use the HTTP Requests feature within Custom Code to integrate data from APIs or external services into your workflow.
Q: Are there any limitations to the Custom Code Action?
- A: Yes, contact information is passed during testing, but other custom values are not. Additionally, you’ll need to manually assign key names in the Property fields for mapping values from previous steps.
Q: Is the Custom Code Action available in all workflows?
- A: Custom Code is available under Internal Tools in the workflow editor. Ensure your account has access to this feature as part of your plan.