Authors: Riddhi Lodha & Akilandaeswari Venkatesh
This blog serves as a reference guide on how to integrate Salesforce and Quickbooks using MuleSoft Composer.
What is Salesforce?
Salesforce is a cloud-based CRM platform that helps businesses manage their customer data, day-to-day sales operations, and campaign management.
Integrating QuickBooks Online with Salesforce makes it possible for companies to have an overall view of their business. This means businesses can share their data, such as customer information, invoices, sales orders, and expenses, between the sales and accounting departments and reduce a lot of manual effort.
What is QuickBooks?
QuickBooks is an accounting software that offers small and medium-sized businesses a collection of applications for bookkeeping purposes. It allows organizations to keep their financial data consistent and organized.
What is MuleSoft Composer and its purpose ?
The MuleSoft Composer is an integration tool that helps organizations connect the two platforms securely and quickly at a minimal cost of development. It consists of a drag-and-drop interface to create powerful and dynamic integration flows with ease.
Composer helps us to keep the Quickbooks and Salesforce records in sync by allowing us to make use of custom objects and fields available on both platforms to map with each other for integration. This integration allows us to quickly synchronize transactions, invoicing information and customer data from QuickBooks to the Salesforce platform and vice-versa.
We’ll guide you through the steps to create a bi-directional flow for integrating Salesforce and Quickbooks. To achieve this, we are going to create two flows:
- To create a customer record in Quickbooks based on specific conditions when an opportunity stage in Salesforce is marked as ‘Closed Won,’ using MuleSoft Composer.
- Whenever an update is made on Quickbooks customer record then it should reflect on the Salesforce Account object as well.
Flow 1: Create customer record in Quickbooks
- Login to MuleSoft Composer and open Flows dashboard on the left.
- Click on Create New Flow and select Create Flow from Scratch.
- Click the pencil icon and rename the flow ‘Create record from Salesforce to Quickbooks’ and click on System Event.
- Select Salesforce from the list of apps available.
- Click Add new Salesforce connection to establish a connection with your org.
- Name the connection, and if you are connecting to a sandbox organization, then select the ‘This is a sandbox organization’ checkbox and click ‘Connect.’
- Enter your Salesforce org username and password, click on ‘Login to Salesforce,’ and then grant permission to allow access.
- Now, start configuring the trigger every time a new opportunity or an existing opportunity stage is marked as ‘Closed Won.’
- In Choose an event that starts this flow, select New or updated record.
- In Object type, select Opportunity.
- In trigger conditions, select All conditions must be met (AND).
- Select Stage as the field, Equals as the operator, Closed Won as the value.
- Click on the + icon below the first step and choose System action.
- Select Quickbooks online from the list of apps that appear.
- Click on Add new Quickbooks Online connection to establish a connection with your Quickbooks environment.
- Name the connection and click on Connect, then enter your Quickbooks environment credentials and click on Sign In.
- In the second step, choose Create customer action from the given picklist.
- As soon as you select create customer, a list of Quickbooks fields will appear and we have to map the corresponding salesforce fields against them.
Example: Choose Salesforce Name field against Quickbooks Name field, Choose Salesforce Account City field against Quickbooks Billing City field and so on.
Most importantly, map the Account Id field in the Quickbook Notes field.
This will serve as the trigger condition during the update of Salesforce records from Quickbooks (Flow 2).
- Save the flow and then click on Test.
- When it displays Awaiting trigger event, open any Opportunity on your Salesforce environment and then mark the Opportunity Stage as Closed Won and click on Save.
- Wait for the MuleSoft Composer flow to complete the test run. You can also check the Test Output on the right hand side of each step in the flow.
- Open your Quickbooks Online environment and see that the customer record is successfully created there and it contains the values mapped from Salesforce.
Flow 2: Update Salesforce record from Quickbooks
- Open flow dashboard and Create a new flow. Rename the flow and Choose System Event as the starting point for the flow.
- Select Quickbooks online from the list of available apps and then choose the connection name you created in the previous flow or create a new connection.
- Select New or Updated Customer as the trigger action for this flow.
- Click on the + icon and select If/Else Block for configuring the next step.
- Select All conditions must be met (AND) as the criteria, then select The Notes Schema as the Field, Is not empty as the Operator and then click on the + icon below the If/Else block.
Note: We had mapped the Account Id field to The Notes field in the previous flow.
Here, we are checking that if the Notes field is not Empty then a corresponding Salesforce record exists for this Customer.
- Click on System Action and connect to Salesforce.
- Select the Get records action to retrieve the corresponding Salesforce account based on the Account Id mapped to the Notes field.
In the Object Type, select Account and select All conditions must be met (AND) as the filtering criteria.
Now select Account ID as the Field, Equals as the Operator and The Notes Schema as the value.
- Now click on the + icon below this action then choose System Action and connect to Salesforce.
- Now to update the account record, select update record action from the picklist and choose Account as the object type.
Map the corresponding Quickbooks fields from the available list against the Salesforce fields and Save the flow.
- Click on test and go to Quickbooks Online environment and update the Billing City on Customer record.
- Wait for the flow to complete the test run. The test output shows Billing City as Seattle before update.
- Now go to that Salesforce Account record and check if the field value is updated or not.
Here, we can see Account City has been successfully updated to Olympia.
Thus, we have successfully established a bi-directional sync between Salesforce and Quickbooks Online using MuleSoft Composer.