function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

field integrity exception

I'm trying to upload opportunitylineitems but I keep getting the field integrity exception error. I am not sure which field is erroring. I'm uploading opportunity id, pricebookentry id, total price, unit price, quantity. I think I'm misunderstanding the pricebookentry structure. But why might I be getting this error? Thanks for the help



Make sure you are inserting the "IsActive" field.  This is required on insert


OpportunityLineItem has an IsActive field? Or are you talking about the pricebookentry IsActive field? I checked that and all my pricebookentry id's I'm adding with come from active pricebookentrys. This is getting quite confusing.


I created a line item and then dumped all the fields and tried to reimport it as a new item.  After about 10 permitations I found one that did not produce an error.  See the mapping on the screen shot below:

When you do your insert map just the fields:

  • Line Description
  • OpportinityId
  • ProductId
  • Quantity
  • Sales Price (Unit Price)

This worked for me and inserted the product as planned.





Thanks Glenn,

I tried the fields you gave me, and now it's telling me: Error 1218 inserting record: Bad field name 'UnitPrice' in insert call. But when I do a describe on the OpportunityLineItem, UnitPrice is right there. Any ideas?


WhiZa;  If you like you can download my tools and I'll set you up with a trial account.  You can then pull down your meta data and try loading data from a CSV file.  (that's how I figured how to add it to my demo account).  Just make sure you turn the error file verbosity up to "High" and the error log will tell you the fields and values that you are updating.

The files are on the download page of



Here's an example of a record I pass to SFDC:

   <sObjects xmlns:ns3="">
    <OpportunityId xsi:type="xsd:string">006300000016REuAAM</OpportunityId>
    <ProductId xsi:type="xsd:string">00j30000000c6zVAAQ</ProductId>
    <Quantity xsi:type="xsd:double">1.0</Quantity>
    <UnitPrice xsi:type="xsd:double">0.0</UnitPrice>

and it returns the error:   

     <fields xsi:nil="true"/>
     <message>field integrity exception</message>
    <id xsi:nil="true"/>

Could it be that I should not be passing a double into a type currency?


Check the IDs that you are using to ensure they are valid and you have access to them, and make sure that you aren't missing a required ID.

I know the OpportunityID is valid and the ProductID is valid and active. The PricebookEntryID is null because I'm using a ProductID. CreatedByID and LastModifiedById are both auto generated.


I finally got it to append line items. I really don't know how   Basically our company's product list is discombobulated and made it difficult to find the correct pricebookentry/product ID to use. I need to research more about the new relationships between entities and hopefully will never have this issue again. Thanks for the help


Message Edited by WhiZa on 05-03-2004 02:09 PM

In order to add the OpportunityLineItem, did you specify ProductId and PricebookEntryId? If you set a value for one of them, does the other need to be a null value?

When inserting Opportunity Line Items you have 2 options:

The old way:    Include OpportunityId, ProductId, and TotalPrice

The new way:  Include OpportunityId, PricebookEntryId, and UnitPrice

If the ProductId is included it must be the id from the old (deprecated) Product object.  Do not use the Product2Id.  If a ProductId is included do not include a UnitPrice.


I am getting this error too,! 

How do I insert the Sales Price in the Opportunity Line Item? I am using  Data Junction


This is the message I am getting:


Error 1218 inserting record: Bad field name 'UnitPrice' in insert call in Form_Activate(rnstatus.frm) (25508)

NOTE: Be sure to check the log file for additional information.