top of page

Data Structure in Salesforce

Ostrij prefers the invoice data be structured in Salesforce as a header object, which represents the invoice header, and a child object which represents the invoice line items. This could be Opportunity and Opportunity Products or any objects in Salesforce that maintain a parent/child relationship.

 

Invoice Header Fields

At the parent level these are the minimum fields we need to create an invoice in Quickbooks. More fields can be included based on your business logic.

 

  1. Customer QBO ID (Text)

    1. This is generally a formula which pulls the value from the related Account

    2. For existing customers we need to mass update Salesforce with this value.

  2. Primary Billing Contact Email (Text)

  3. CC Email Address (Text)

  4. Invoice Notes (Text)

  5. QBO Term ID (Text – External ID)

    • This is used if you want to set the invoice terms from Salesforce.

    • A formula field can be used to map picklist values to QBO Term ID. Or a custom object can be created to store Term records.

    • If you set the same term on every invoice, then we can hardcode this in the Ostrij flow.

  6. Quickbooks Invoice ID (Text – External ID)

    • This value is set by Ostrij after the invoice is created in QBO
       

Invoice Line Item Fields

At the child (line item) level these are the minimum fields we need to create an invoice in Quickbooks. More fields can be included based on your business logic.

 

  1. Product Lookup Field (If not using Opportunity Line Items)

  2. Quantity (Number)

  3. QBO Product ID (Text – External ID)

    1. Generally a formula pulled from the related Product record. Either custom or standard Product object.

    2. For existing products we need to mass update Salesforce with this value.

  4. Total Price for this line item (Currency)

  5. Unit Price for this line item (Currency)

  6. QBO Tax Code for this line item (Text – External ID)

    1. Can either be hardcoded or dynamic. Meaning we can hardcode the same Tax Code for all Invoice Line Items. Or we can dynamically pull from record in Salesforce.

    2. For existing tax codes we need to mass update Salesforce with this value.

    3. Exclude if not setting tax on invoices

 

Creating the Flow in Ostrij

After setting up authentication for both Salesforce and Quickbooks in Ostrij, here’s how you configure the QBO Invoice “Create Flow”.

  1. Click “My Flows” in the Ostrij header

  2. Click one of the folders or create a new one

  3. Click “Add New Flow”

Flow Step 1

  • What do you want to do = “Webhook”

  • Flow Name = Any string that makes sense to you (ex. SF-QBO Create Invoice)

  • Data Source = Your SalesforceOrg

  • Select Object = Your Invoice Header Object

  • Click “Next”

Flow Step 2

  • Click “No Logic”

  • Dropdown the field list and select all the fields you need to include for the invoice header.

Flow Step 3

  • Operation Name = “Create”

  • Data Recipient = Your QBO Account

  • Data Recipient Object = “Invoice”

  • Data Source (Unique Identifier) = “Id”

Parent Object Field Mapping

Salesforce Parent Object Fields

QuickBooks Field

Hardcoded?

Quickbooks Account ID

CustomerRef > Value

No

Primary Billing Contact Email

BillEmail > Address

No

Invoice Notes

CustomerMemo > Value

No

QBO Term ID

SalesTermRef > Value

Based on business requirements

CC Email Address

BillEmailCC > Address

No

 

  • Next Map the line item object by clicking “Map Lines Object”

  • Select Line Object = Salesforce Child Object

  • Select Line Object Identifier = Field on child object which looks up to parent object

 

Child Object Field Mapping

Salesforce Child Object Fields

QuickBooks Field

Hardcoded?

Line Item Total

Line > Amount

No

Quantity

Line > SalesItemLineDetail > QTY

No

“SalesItemLineDetail”

Line > DetailType

YES

QBO Product ID

Line > SalesItemLineDetail > ItemRef > Value

Based on business requirements

Line Unit Price

Line > SalesItemLineDetail > Unit Price

No

 

  • Click “Callback (Return New Record Id) and then select the “Quickbooks Invoice ID” field you created on the parent object.

  • Click Save

 

Creating the Workflow in Salesforce

This workflow will fire an outbound message to Ostrij in Salesforce based on your custom invoice creation logic
 

  • Stay in Ostrij and click “My Flows” and then the folder you saved your flow in eye

  • Click the icon next to your flow

  • Then copy your “External endpoint URL”

 

  • Then copy your “External endpoint URL”

  • Next navigate to Salesforce and click on Setup > Workflow Rules

  • Create a new workflow rule on your parent (invoice header) object

  • Logic of this workflow is based on your custom business logic. Can fire on record creation or a certain status or a checkbox being checked.

  • Click “Add Workflow Action” then “New Outbound Message”

    • Name = Any string (ex. Ostrij – Create Invoice in QBO)

    • Endpoint URL = Paste the endpoint you copied in Ostrij

    • Protected Component = False

    • Send Session ID = False

    • Fields to send = id

      • No need to send any other fields.

    • Click Save and Save and Activate Workflow

 

NOW YOU’RE READY FOR TESTING!!

bottom of page