Workflows
and create a new workflow by clicking on +Add Workflow
button and name it as Sync Opportunities
.
Build Workflow
Follow the steps given to build the workflow:1
Add Trigger in Start Node
All workflows start with a trigger, which determines when the workflow will run and how data is passed into the workflow.
For this workflow we will use the Event Based trigger.Click on the
Give a name to your event and keep the payload as an empty object.
Learn more about the triggers and its types here.
Start Node
, select your native app option and click on + Create New Event
.
2
Add Salesforce Node
Now to fetch all the opportunities present in your user’s account, we need to call Salesforce API.Click on 
Nodes
option in the top right and drag the Salesforce Node from Native Apps section to the workflow builder. Connect this node with Start Node.
3
Fetch Opportunities from Salesforce using Action
Click on the Salesforce Node and select
Add the following under
Get Entity with SOQL
action.
SOQL query
field and click on Save
.You can provide any additonal fields that you want to fetch about opportunities from Salesforce by adding it to this query.
4
Add Custom Code node
We have fetched all the opportunities, but you might require to structure it as a payload which your platform can receive. Let’s do this using Custom Code node.Drag the Custom Code from the Utility Nodes section onto the workflow builder and connect it with Salesforce node.
5
Mapping Opportunity fields
Click on
You can now do mapping using JavaScript code. Try the sample code provided below:
+ Map Fields
under Input Parameters, add key name as deals
and in value we will provide the response received through Salesforce node which will be restructured.In Value
, select Nodes tab under Insert Variable and click on +
of the Salesforce Node.
6
API Proxy in Workflow
You have successfully fetched all opportunities and structured the payload. Now to receive it in your server, you need to configure an API Proxy.In Cobalt Dashboard, navigate to 
Developer
> API Proxies
and click on New Action
. Configure an API endpoint, where you want to receive the response.If you want to test, go to webhook.site and copy Your unique URL
and configure this as a POST Request and Save
.
Learn more about API Proxies here.
7
Use API Proxy in Workflow
From Native Apps nodes, add your org’s Node and connect it with Custom Code.Click on the node and select the API Proxy that you created from the Actions. Add the response from Custom Code node in data field and click on 
Save
.Ensure that you add a field in the API Proxy where you can pass the JSON data and then added it to the API Call body as well in the POST request.

Test Workflow
Once your workflow is built, you can perform both node level and workflow level testing to check it. Before testing a workflow, ensure the following pre-requisites are completed:- Linked Account configured with authentication completed with the integration.
- Sample Payload for testing is available & configured.
Learn in depth how you can configure the pre-requisites in our Workflow Testing guide here.
Testing Node
1
Select Node
Click on the node you want to test.
2
Run Node
In the node, switch to 
Input/Output
tab and click on Run Node
button.
Testing for Group Node and Pagination is currently not supported.

Once the node executes successfully, a checkmark appears on the node, indicating it has been tested.
Testing Entire Workflow
Open the testing modal present at the bottom. Click onRun Workflow
button to perform a test execution and a Test Run log is generated with output of each node.
Since testing for Group nodes is not supported currently, you might not receive the logs of the group node.

Hurray!!You have successfully created and tested a Salesforce workflow to sync all the opportunities to your system.