+ Start a Discussion
Eduardo DeslandesEduardo Deslandes 

inputField with value Product2Id not working

Hi, I'm developing a visualforce page to insert a new OpportunityLineItem, but the inputField above is not working:
<apex:inputField value="{!OpportunityLineItem.Product2Id}"/>

It shows only the label.

Anyone could help me?

Best Answer chosen by Eduardo Deslandes

All Answers

SandhyaSandhya (Salesforce Developers) 

Usually, when we want to retrieve product2Id, we will use
SELECT PricebookEntry.Product2Id FROM OpportunityLineItem
Try this
<apex:inputField value="{!OpportunityLineItem.pricebookentry.Product2Id}"/>

Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards

Eduardo DeslandesEduardo Deslandes
Thanks, but I've changed the inputField and it didn't work.
Eduardo DeslandesEduardo Deslandes
This was selected as the best answer