You need to sign in to do that
Don't have an account?
Enry
Set Product for new opportunity lineitem
in a trigger i'am going to create a new opportunitylineitem for an opportunity:
OpportunityLineItem newOpptLineItem = new OpportunityLineItem();
newOpptLineItem.OpportunityId = opptInserted.Id;
newOpptLineItem.=cs.OppProductCpvId__c; // FOR GIGABYTE
newOpptLineItem.Quantity = 1;
newOpptLineItem.PricebookEntryId = peWEBinteractive.Id;
opptLineItemsToInsert.add(newOpptLineItem); .
I want to set up a product for this new opportunitylineitem.
newOpptLineItem.ProductId isn't available.
Thanks in advantage for any advice.
ProductID - ID of the associated Product record. This field is unavailable as of version 3.0 and is only provided for backward compatibility. The Product object is unavailable beginning with version 8.0. Use the PricebookEntryId field instead, specifying the ID of the PricebookEntry object.
This field is not available.
newOpptLineItem.PricebookEntryId = peWEBinteractive.Id;
You have done this. this means the product of this pricebookentry will be automatically in the productid of Opportunitylineitem.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
All Answers
ProductID - ID of the associated Product record. This field is unavailable as of version 3.0 and is only provided for backward compatibility. The Product object is unavailable beginning with version 8.0. Use the PricebookEntryId field instead, specifying the ID of the PricebookEntry object.
This field is not available.
newOpptLineItem.PricebookEntryId = peWEBinteractive.Id;
You have done this. this means the product of this pricebookentry will be automatically in the productid of Opportunitylineitem.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Thank you very much! how can i create a PriceBookEntry from user interface? after i will store the pricebook id in a custom setting.
Thanks again!
Create a PriceBookEntry from user interface means? You want to select opportunity lookup in UI? You can create that and you can assign that pricebbookid in controller or you can choose that as well in Ui through input field.
If the post helps you please throw KUDOS.