Print this page

Mapping Work Order Line Items to Products with the Data Loader after Winter '17

Knowledge Article Number 000247063


Prior to the Winter'17 release, it was possible to edit the "Product2" lookup field on the Work Order Line Item object with inserts, updates, and upserts in the Apex Data Loader.

Starting with Winter '17, the "Product2" lookup field is now read only on the Work Order Line Item object and only the "PricebookEntryId" lookup field on this object can be updated. Once that field is populated and the record is saved, the "Product2" association will automatically populate based on the "PricebookEntryId" field value (Note: The label name for the editable "PricebookEntryId" field remains the same: Product).

If you were using the pricing fields on Work Orders before Winter ’17, we recommend taking the following steps:



Recommendationed actions related to the Winter ’17 release

  • Update to API version 38.0 (Winter ’17) to keep your data in sync.
  • If you’ve written custom code or apps that reference the "Product2Id" field on Work Order Line Items, update your code to reference the "PricebookEntryId" field instead.
  • Check your Work Order Line Item page layouts to make sure they contain the Product field (API name: PricebookEntryId) so you can continue associating work order line items with products.

Additionally, if you have data import procedures that include updating the "Product2" field on Work Order Line Items will need to adjust their processes to use the "PricebookEntryId" value instead. Specifically, the CSV file used for this import will now need to include a PricebookEntryId column with PricebookEntry record IDs that correspond to the product relationship for each Work Order Line Item (each row).

Learn more about streamlined Work Order pricing in the Winter '17 Release Notes.

Additional Considerations For Determining Pricebook Entry record IDs

  • The Price Book Entry record associated to the Work Order Line Item must be part of the Price Book to which the parent Work Order record is already associated.
  • A Price Book Entry record will need to exist for every combination of Pricebook and Product. Organizations with mulitple pricebooks should have a Price Book Entry record for a given Product equal to the number of pricebooks (standard and custom).
  • Additional Price Book Entry records may be required to exist in orgs where multiple currencies are in use, or where the standard billing frequency field is in use on Price Book Entry.

Additional Considerations for Mapping Products with External ID Fields

If an External ID custom field on the Product (Product2) object was used prior to Winter '17 for the purposes of associating Products to Work Order Line Item records on upsert, access to this field via API tools will also be removed as a result of the Winter '17 change described above.

To replicate this External ID association in Winter '17 and later, a corresponding External ID custom field can be created on the Price Book Entry object and populated with External ID values.

NOTE: Because of the factors outlined in the section above regarding Price Book Entry records, each Price Book Entry's External ID value will need to be sufficiently unique as to differentiate the record corresponding to one pricebook/product/currency/billing frequency combination from the same product in a different pricebook, etc.

Example SOQL queries to obtain PricebookEntryId

One way to obtain the correct PricebookEntryId for each Product2 value is to query agains the PricebookEntry object filtering by the Product2Id field, Pricebook2Id field, and if applicable, the CurrencyISOCode field.

Some examples of this might be: 

SELECT Id FROM PricebookEntry WHERE Product2Id = 'xxxxxxxxxxxxxxx' 


SELECT Id FROM PricebookEntry WHERE Product2Id = 'xxxxxxxxxxxxxxx' AND Pricebook2Id = 'xxxxxxxxxxxxxxx' 


SELECT Id FROM PricebookEntry WHERE Product2Id = 'xxxxxxxxxxxxxxx' AND Pricebook2Id = 'xxxxxxxxxxxxxxx' AND CurrencyISOCode = 'YYY' 

Related help content


promote demote