You need to sign in to do that
Don't have an account?

Inserting/updating OpportunityLineItem using REST API
Hello everyone,
The SalesForce REST API doc is unclear about the usage of APIs to insert and update records in OpportunityLineItem. The standard fields in OLI include OpportunityId and Product2Id both of which I'm populating by retrieving the appropriate SalesForce IDs. I receive this error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY when I try to insert a record at this URI: /sobjects/OpportunityLineItem/.
Going through the flow: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_products.htm#topic-title, I'm assuming this (and also the cross-reference error) means that there is no direct relationship between OLI and Products.
Firstly, why is there a Product2Id field if the relationship doesn't exist?
Secondly, is the URI I'm using incorrect? If so, what is the correct one?
Thirdly, can this problem be solved using APIs at all?
Maybe I'm going about this in a completely inefficient manner. Any suggestions would be greatly appreciated.
The SalesForce REST API doc is unclear about the usage of APIs to insert and update records in OpportunityLineItem. The standard fields in OLI include OpportunityId and Product2Id both of which I'm populating by retrieving the appropriate SalesForce IDs. I receive this error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY when I try to insert a record at this URI: /sobjects/OpportunityLineItem/.
Going through the flow: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_products.htm#topic-title, I'm assuming this (and also the cross-reference error) means that there is no direct relationship between OLI and Products.
Firstly, why is there a Product2Id field if the relationship doesn't exist?
Secondly, is the URI I'm using incorrect? If so, what is the correct one?
Thirdly, can this problem be solved using APIs at all?
Maybe I'm going about this in a completely inefficient manner. Any suggestions would be greatly appreciated.
In standard way, you have to pass pricebookEntry id, in opportunitylineItem product2Id is not writable field so, if you want to insert opportunityLineItem then you need to create instance of opporunitylineItem mentioned below.
Please try with this , and if you have any issue then please let me know.
Thanks,
Keyur Modi
All Answers
In standard way, you have to pass pricebookEntry id, in opportunitylineItem product2Id is not writable field so, if you want to insert opportunityLineItem then you need to create instance of opporunitylineItem mentioned below.
Please try with this , and if you have any issue then please let me know.
Thanks,
Keyur Modi
Using Rest API iam trying to get opportunity line item data/v47.0/sobjects/OpportunityLineItem but it is not returning any object .how to get opportunity lineitem id .
Thank you for your reply. I probably should have made this clear in my original post.
Good Night Images
Happy Birthday Brother Images