Authors: Palash Samar and Laveen Patidar
QuickBooks with Salesforce integration provides full visibility into your business performance and areas for improvement. Integrations help reduce data duplication, improve productivity, and provide insights for better forecasting.
With MuleSoft Composer, we are able to create seamless integrations between Salesforce and QuickBooks, enabling data synchronization, automation, and business processes between the two platforms without writing heavy code. It provides pre-built templates and connectors for Salesforce and QuickBooks, which eases the integration process.
Integrating Salesforce to Quickbooks using MuleSoft Composer’s HTTP Connector and Quickbooks REST API, as it provides us more flexibility to configure/mapping of fields as compared to QB Connector in Composer.
E.g. Opportunity status is ‘Closed Won’, invoice should be created/updated in Quickbooks and Quickbooks Invoice_Id should be stored back to Salesforce Opportunity Object.
Comparison b/w QB Connector and QB Rest API
|QB Connector||QB Rest API (Http Connector)|
|Basic Authentication is available||More secured as Different Authorization Type eg. OAuth 2.0 Authorization Code is available|
|Provides limited/predefined business accounting entities in composer – Customers, Invoice, Item, Estimate with the basic operations like – Create, Get, Update, Query||Provides access to various business accounting entities managed on the platform, such as accounts, suppliers, customers, employees, bills, invoices, taxes, estimated transactions along with all the defined HTTP methods|
|Gives all the list of fields mapping for the object despite its need||More control over available operations as we need to put example requests based on which we get fields for mapping|
|More operations are not available||More operations are available e.g. send an invoice|
- Access required for Salesforce, Quickbooks and MuleSoft Composer.
- The Salesforce Account should be synced with Quickbooks Customer.
- Salesforce Product should be synced with Quickbooks Item.
- Custom field(QB_Invoice_ID) should be available in the Salesforce Opportunity Object to store invoice Id created in quickbooks.
To use the HTTP connector and Quickbooks REST API, first, we need connected app credentials which help us connect Composer with the Quickbooks environment via the Quickbooks REST API.
Let’s go back to Composer and try to connect with Quickbook through HTTP Connector.
Step 1: Based on requirement, select scheduler or system event to trigger Salesforce event i.e. whenever Opportunity Object status changes to ‘Closed Won’, composer flow should be triggered.
Step 2: Select HTTP Connector from the system action and to create the connection with quickbooks follow the instructions.
- Base URL: –Sandbox
- Client ID and Client Secret: to get these values, go to API Playground
Request path: /v3/company/<insert-realm-ID-here>
To get the realm ID, – on the right side, select sample query – select “try it” – it will return the realm ID (CompanyId and realmID are same).
- You need to add a header (because Quickbooks responds with XML format by default).
Key: Accept Value: application/json
The connection should be established.
Step 3: For the next step, as we are creating INVOICE, do the following configuration.
Enter these values:
HTTP method: POST
Note: HTTP method and path values for required operation visit API Explorer.
Step 4: Add the example request that we can obtain from the API explorer. Based on this, we will gather all the fields required to create an invoice, including custom fields and other necessary fields.
Note: Based on a predefined Quickbooks object (e.g., invoice), we will add an example request, by which we will be able to access all the fields available in the object (including some other fields) which were not accessible at the time of using QuickBooks Connector.
Here, we can use only those fields that are required for our use case and remove the remaining fields from the object. However, we cannot add fields from our side that are not part of the actual QuickBooks object.
Step 5: Under “Body” – click “Select Additional Fields”, to select the fields which are required (you can also select all fields) and Apply.
Step 6: All fields related to invoice will be visible for the mapping.
Step 7: For further steps select the following options and complete the flow.
Step 8: After testing the flow, we will be able to see test output as highlighted. If it successfully runs, we will see below, otherwise there will be an error in test output.
Step 9: Click on Activate to deploy the flow after successful testing of flow.
- Go To MuleSoft Composer.
- Click on flow and choose specific flow. Monitoring can be done from here & for Testing and Activation/Deactivation, click VIEW Button (available in the top most right corner).
Test a Flow
In order to test the flow, click on TEST.
The Testing phase of the flow is active for 10 minutes and can be tested for a single event. The testing flow gets closed, after the testing is successful or failed.
Activate a Flow
In order to activate the flow, click on ACTIVATE.
It will run integration flow continuously in the background. After activating the flow, the status of the flow gets changed to Active which can be seen in either overview section or flow section in the status column, otherwise it remains Inactive.
Deactivate a Flow
In order to deactivate the flow, click on DEACTIVATE.
It can be seen that after deactivating the flow, status again changes to Inactive from Active.
Monitor/Troubleshoot a Flow
After Activating the flow, check flow status in the Run History section and monitor every time the flow is triggered.
If the Status is FAILED, there will be an error description in the Run History Section, which can be monitored in order to debug the problem.
QuickBooks REST API provides us with more flexibility in terms of configuring and mapping all fields compared to the QB Connector in Composer. It also provides additional functionality that is not available in the QB Connector, such as ‘Email Sent,’ etc.
So we can say, if with the Quickbooks Connector, we are not able to achieve the business requirement/goal, then it is good to use Quickbooks REST API via HTTP Connector in Composer.