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
TrojanUV-DZTrojanUV-DZ 

Upserting an OpportunityLineItem

I've created a data synchronization service in .NET and have everything working except for OpportunityLineItems. The problem is if the item exists in Salesforce I can't specify a PricebookEntryID because it says I don't have to correct permissions to update it. I am logged in as admin and have full rights to everything.

 

So then if I remove the PricebookEntryID the record upserts fine. But if a new record is to be inserted Upsert fails because the PricebookEntryID is required.

 

Of course I could solve this by querying Salesforce to see if the LineItem exists and calling update or create. But isn't that what upsert is supposed to do?

 

So basically Upsert on OpportunityLineItem is useless.

 

Anyone come accross this and have a solution?

dkadordkador

Your analysis sounds correct, unfortunately.

 

I'd suggest posting an idea on the idea exchange for us to do better in this area.

letsgoletsgo

Hello: I am getting the same error. Were you able to resolve this issue? Thanks!