Documentation
The Javascript step can be used to add JavaScript functions to your workfows.
This allows you to programmatically process the output of the previous steps and can be useful in many cases. Instead of writing a lot of steps to manipulate the data these steps help you to keep the workflow easy.
For example
Example 1:
Let’s say you want to sync Contacts from Shopify to Salesforce. The mapping of contact data is easy for text fields but can get hairy for lookups like States, Countries, and others. Doing it in steps will requires creating 100s of steps, one for each lookup:
Bit if you have access to JS code you can just create a simple Dictionary and use it for mapping
And when you need to map data you do:
Salesforce Contact State <<map from>> <shopifytoSfState[shopify contact. state]>
That’s it.
Your flow can stay nice and simple and not be polluted with 100 steps just to map one lookup field.
We decided to add a code step in pandaflow so that it is easier to add these types of logic within the workflow when it is needed.
Example 2:
Nested loops are very common when you are dealing with data of any complexity such as orders. For example, if I want to get all the orders from Shopify and create Salesforce Opportunities you would need to create an outer loop to iterate through the orders and then an inner loop that would iterate the order items for each order to convert them to salesforce opportunity items.
In code, it would be pretty straightforward.
In PandaFlow it is pretty simple. You can create as many loops and nested loops as you like. And you can also introduce Javascript snippets for any complex mappings.