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
kaushik Sabapathykaushik Sabapathy 

How to create records for OpportunityLineItem

Hi all,
          I want to create records for "OpportunityLineItem".Unlike other standard object,creating records for ooportunityLineItem is quite different.
eg:to create a contact record for an account,I click on the Account record and add related contact(or) I click on the contact tab lookup an account for that contact.
             But for creating opportunityLineItem from opportunity it is different,When i click on add product I cannot see OpportunityLineItem fields which are in pageLayout but not in the detail page of OpportunityLineItem(opportunity Product).
I also tried to create record by defining field value for opportunityLineItem,but I am getting"
Price Book Entry ID: Id Value Of Incorrect Type" this error.
Please help me to create OpportunityLineItem record in whichever method you know.
Best Answer chosen by kaushik Sabapathy
Maharajan CMaharajan C
Hi Kaushik,

First you need to understand what is OpportunityLineItem : 

Opportunity Line Item is nothing but product which u added to a particular opportunity  OR  When you add a product to Opportunity it is called Opportunity Line Item  which you use during your slaes.

So this youtube video will help you to add a products under Particular Opportunity : https://www.youtube.com/watch?v=jm46QcxVMbI

Watch the video from starting to 1:18 minutes.

Let me know if you want any further help.

If those points are help means mark these as a best answer.

Thanks,
Raj
(Sweet Potato Tec)
 

All Answers

Maharajan CMaharajan C
Hi Kaushik,

First you need to understand what is OpportunityLineItem : 

Opportunity Line Item is nothing but product which u added to a particular opportunity  OR  When you add a product to Opportunity it is called Opportunity Line Item  which you use during your slaes.

So this youtube video will help you to add a products under Particular Opportunity : https://www.youtube.com/watch?v=jm46QcxVMbI

Watch the video from starting to 1:18 minutes.

Let me know if you want any further help.

If those points are help means mark these as a best answer.

Thanks,
Raj
(Sweet Potato Tec)
 
This was selected as the best answer
VineetKumarVineetKumar
Please refer you code here.
kaushik Sabapathykaushik Sabapathy
Thank you maharaja and vineetKumar.I found the solution  I have to add Pricebook for the the opportunity product