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

Insert query to Products

Does someone have a sample query for inserting products in C#? I can't seem to find anything to help.


I'm getting this error.

Error creating line item: field integrity exception: PricebookEntryId (pricebook entry not in opportunity pricebook)

Here is the code I am using

sForce.OpportunityLineItem oli = new sForce.OpportunityLineItem();
oli.Description = sDesc[x];
oli.OpportunityId = oppId;
oli.PricebookEntryId = "01u30000000QXMzAAO";
oli.Quantity = double.Parse(sQuantities[x]);
oli.QuantitySpecified = true;
oli.UnitPrice =double.Parse(sUnitPrice[x]);
oli.UnitPriceSpecified = true;
sForce.SaveResult sr = binding.create(new sForce.sObject[] {oli})[0];
Did you figure this out?