Internal Functions
Create reusable functions or provides built-in, non-editable library functions in workflows.
A Custom Code node is used to solve any data-related issues that required coding in the workflows. If the same code was needed at multiple places, the users need to use a Custom code node with the same code in different workflows.
If you want to learn more about Custom Code Node, refer here.
To reduct this repetitive process, the solution is the Functions node. Using this, you can create reusable functions at the global level for your Cobalt account, which can then be used inside workflows.
Create your Functions
You can create your own functions to be used in the node by providing three things:
- Code for the function
- Input fields
- Output fields.
To create your own function, follow these steps:
Navigate
In the Cobalt dashboard, navigate to Functions
under Advanced in the side menu.
Create function
Click on + Create Function
button and provide its Name.
Write function
Write your function and also define the input and output parameters that you require.
Once done, click on Create
.
You can also use JavaScript Libraries supported by Cobalt in the function code. Refer here to check the list of supported libraries.
Once a function is created, you can also edit it as required by selecting that function from Functions
.
Supported JavaScript Libraries & Usage
The full list for the supported npm modules that can be used to write your own internal function is below. If you don’t see the module that you want, contact us and we will get that added.
How to use Libraries
To know how you can use these external libraries in your Internal Code function, refer to the examples below for axios and lodash.
Pre-defined Library functions
You can also use some pre-defined functions, also known as Library functions offered by Cobalt. These functions show up in the Functions node by default and can’t be edited.
Few of the library functions are:
- Find element in array,
- Encrypt string,
- Get current date; & many more.
Once you select a function, simply provide the required inputs to perform it.