SalesTrip can be configured to push your employee's expense claims to QuickBooks for processing into your accounts and to manage reimbursement of your employees or card programmes.
SalesTrip creates Bills in QuickBooks, which are linked to Vendors. The Bill contains each SalesTrip expense as a line, with data including date, amount, expense type, description and customer populated.
Before you start, ensure your user has the SalesTrip Administrator permission set.
Connect SalesTrip to QuickBooks
Navigate to the "Connections" tab
Click the "New" button at the top right, and then "Connect to QuickBooks"
Login to QuickBooks, and authorise the SalesTrip application to access your account
You'll be returned to SalesTrip to configure the integration
Select the Accounts Payable Account the Expense report will be linked to.
Select the Bill Date for each Expense Report to be sent to QuickBooks. This can be the date the report is generated, or the maximum date of all the expenses in the report.
For each SalesTrip Expense type, choose the Expense Account in QuickBooks to apply to the Expense in the Bill.
Click Save and your connection is configured. Edit the Connection to update the mappings.
Setup Vendor Ids
Each Bill in QuickBooks needs to be linked to a vendor. Typically, you might have your Employees configured as vendors to track reimbursements to these employees, but you might also have your card programme set up as as a vendor if it is a company paid programme.
Each of these Vendors has an id in QuickBooks which SalesTrip needs to use to connect the Bill to the correct Vendor. Find the id for each vendor in QuickBooks, and store it on an appropriate object in Salesforce. This might be the User object, or the Payment Method or Financial Provider Connection objects for a card programme.
You can get a vendor id from the QuickBooks URL when viewing a Vendor (navigate to Expenses -> Vendors and click a Vendor). The id is 56 in the below example.
Apply Vendor Id to an Expense
When an Expense is created or saved, the vendor id for when the Expense is added to a Bill should be populated into the field salestrip__ExternalPayeeId__c
. At the same time the field salestrip__ExternalPayeeType__c
should be populated with the value 'Vendor'
. This can be done in a number of ways, typically a before save flow or a before insert / update trigger. You might consider creating a formula field on the Expense object to retrieve the correct vendor id from the appropriate record based on your business logic (where should the reimbursement go?), which then simplifies the logic and permissions to copy this value to the External Payee Id field.
Link Expense Lines to Customers
SalesTrip can also link your Expense lines to appropriate customers, to account for spending on that customer and allow for rebilling. Populate the field salestrip__ExternalCustomerId__c
on the Expense with the QuickBooks Customer Id to link the Expense lines. You'll probably want to do this in the same manner you did with Vendor Ids, and pull the Customer Id from the Opportunity, Account or other Custom object related to your Expense. You can also expose the field salestrip__Billable__c
to users to allow them to select whether the Expense is Billable, do this by adding the field to the field set "Additional Fields" on the Expense object.
Override Account Id
By default SalesTrip will put each Expense Line against the account defined by the mapping from Expense Type to QuickBooks Account configured when you configured the Connection. You can override this by populating a QuickBooks Account Id into the field salestrip__ExternalAccountId__c
. To identify the correct QuickBooks Account Id you can see this number in brackets in the dropdown when configuring the Connection (click "Edit", and open the mapping dropdown).
Generate Expense Reports
SalesTrip generates expense reports by selecting all the previously approved expenses (status is 'Pending Reimbursement') which are not already on a report, and creating a report for each unique value in salestrip__ExternalPayeeId__c
with the appropriate expenses linked to the report. This data is then ready to export to QuickBooks. These reports are all linked to a salestrip__Export__c
record which is created by the job.
To generate expense reports, run the following apex in execute anonymous:
Database.executeBatch(new salestrip.ExportReportGeneratorBatch(
Id connectionId, //id of QuickBooks Connection record created earlier
Boolean initiateExport, //expense reports are pushed to QuickBooks once job completes
String queryClause // any additional filters to apply
));
e.g. without additional filters
Database.executeBatch(new salestrip.ExportReportGeneratorBatch(
'aaa000000000000',
false,
''
));
e.g. with additional filters - filtered where Legal Entity = 'United Kingdom'
Database.executeBatch(new salestrip.ExportReportGeneratorBatch(
'aaa000000000000',
false,
' AND Legal_Entity__c = \'United Kingdom\''
));
You can also schedule this job to run at intervals using an apex schedule, e.g. without additional filters
System.schedule(
'SalesTrip QuickBooks Export',
'0 0 23 * * ?',
new salestrip.ExportReportGeneratorSchedule(
'aaa000000000000',
false,
''
));
You can also schedule this job to run at intervals using an apex schedule, e.g. with additional filters
System.schedule(
'SalesTrip QuickBooks Export',
'0 0 23 * * ?',
new salestrip.ExportReportGeneratorSchedule(
'aaa000000000000',
false,
' AND Legal_Entity__c = \'United Kingdom\''
));
See the Salesforce documentation for more information.
Once the job completes you will see the records created in the object salestrip__Report__c
.
Push Expense Reports to QuickBooks
Once an Export record with related Report records is created, it can be pushed to QuickBooks. This will result in a Bill being created in QuickBooks for each Report related to the Export.
You can push the reports to QuickBooks by setting initiateExport
to true
when generating a report, or if you prefer to inspect the reports before they are pushed to QuickBooks, then you can run the push job separately
Database.executeBatch(new salestrip.QuickBooksExportReportPushBatch(
Id exportId, //id of export record created by ExportReportGeneratorBatch
));
Update Expense Status to "Reimbursed"

