Specifying Bills and Purchase Orders
Create Bills and Purchase Orders
You can create Bills and Purchase Orders in QuickBooks in the same way as Invoices by configuring a custom Button URL in Salesforce.
1. Configure the Button URL
Use the following URL parameters to map Salesforce fields to QuickBooks Bill or Purchase Order fields.
Example: Create a Bill
/apex/breadwinner_qbo__NewBillPO
?originating_record={!salesforce_record_ID}
&parent_account=api_field_name__c
&invoice_date=bill_date_api_field__c
&invoice_location_field=api_field__c
&invoice_memo_field=memo_api_field__c
&child_relationship_name=child_name__r
&child_object_inventory_name=name_field__c&child_object_description=description__c
&child_object_quantity=quantity_field
&child_object_unit_price=unit_price_field__c
&child_object_class=class_field__c
&child_object_customer=api_field__c
&expense_type=bill
&Itemmapping_preference=ItemsRequired configuration
- Replace the example field names with the corresponding Salesforce API names.
- Set originating_record to the Salesforce record ID from which the Bill or Purchase Order will be created.
- Set expense_type to bill for a Bill or po for a Purchase Order.
2. Configure Line Item Mapping
QuickBooks supports two types of line items: Item-based and Account-based. You can configure only one mapping type at a time.
Item-based Line Items
Use Item-based mapping when each line item corresponds to a QuickBooks item.
Set the following parameters:
Replace name_field__c with the Salesforce field that identifies the QuickBooks item.
Account-based Line Items
Use Account-based mapping when each line item corresponds to a QuickBooks account.
Set the following parameter:
For Account-based mapping, the child_object_inventory_name parameter is not required.
3. Specify a Customer for Each Line Item
You can associate a QuickBooks Customer with each line item on a Bill or Purchase Order.
Prerequisite: Enable Track expenses and items by customer in QuickBooks. If this setting is disabled, the Customer value specified in the URL is ignored.
There are two ways to specify the Customer for a line item.
Option 1: Custom URL — Use a Field on the Child Record
Use child_object_customer_account to specify the Salesforce field on the child record that contains the Customer value.
Parameter | Description | Example |
|---|---|---|
child_object_customer_account | A field on the child record containing the Customer value | &child_object_customer_account=Customer_Account__c |
This configuration applies the specified child-record field to the line items being created.
Option 2: Line Item URL — Specify a Customer for Each Line
Use lineN_customer to specify the Customer separately for each line item. Replace N with the line number.
Parameter | Description | Example |
|---|---|---|
lineN_customer | A field on the originating record | &line1_customer=AccountId&line2_customer=End_Customer__c |
For example, line1_customer specifies the Customer for the first line, while line2_customer specifies the Customer for the second line.
Supported Customer Values
Both parameters accept either a Salesforce field API name or a Salesforce Account ID (15 or 18 characters).
The specified field can contain any of the following:
- A Salesforce Account ID
- A QuickBooks Customer Display Name
- A QuickBooks Customer ID
4. Example: Create a Bill with Different Customers on Each Line
Consider a Bill created from a Salesforce Opportunity with two item lines. Each line is associated with a different QuickBooks Customer.
Configure the Button URL as follows:
In this example:
- originating_record identifies the Opportunity from which the Bill is created.
- parent_account specifies the Vendor Account field.
- Itemmapping_preference=Items configures Item-based line items.
- line1_customer and line2_customer specify the Customer for each line item independently.
Replace the example field names with the API names used in your Salesforce org.