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
mojavemojave 

Access to product name within an OpportunityLineItem?

How does one access a product2's name (description) within an OpportunityLineItem?

 

I don't care about the product's ID or price book information--just the product's name.  I haven't figured out how to do this yet, though it seems like it should be simple...

 

I'm building (hopefully some day) a OpportunityLineItem trigger to update a field elsewhere based on whether or certain products appear in line items.

 

Thanks,

Kevin

Best Answer chosen by Admin (Salesforce Developers) 
jeffdonthemicjeffdonthemic

Try this:

 

 

Select name from Product2 Where Product2.id = :oli.PricebookEntry.Product2Id

 

Vote for my Idea: Enhanced Apex Testing Functionality (JUnit) Link

 

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

 

All Answers

jeffdonthemicjeffdonthemic

Try this:

 

 

Select name from Product2 Where Product2.id = :oli.PricebookEntry.Product2Id

 

Vote for my Idea: Enhanced Apex Testing Functionality (JUnit) Link

 

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

 

This was selected as the best answer
mojavemojave

Thanks a bunch!  Part of the problem for this newbie here is figuring out what is connected to what (unlike databases that I put together myself).

 

Kevin