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
SidMSidM 

Trouble using PricebookEntryId as inputField

I am in the process of creating a more advanced version of the Opportunity Line Item entry page in VisualForce. All going well so far, except that I need to allow the user to select a Pricebook Entry as a lookup relationship when adding  a new line item.

 

If I use the following code, everything seems fine until I click the lookup search button to select a new price book entry (product) and I get an error in the search lookup saying:

 

Required parameter "Missing the parent_id" not defined.

 

Here's the code:

 

<apex:column headerValue="Product" style="width:80px;">

<a href="../{!item.id}">{!item.PricebookEntry.Name}</a>

<apex:outputPanel rendered="{!isnull(item.PricebookEntry.Name)}">

<apex:inputField id="priceBookEntry" required="true" value="{!item.PricebookEntryId}" />

</apex:outputPanel>

</apex:column>

 

Should I be using this Id, or is there another way of doing this? I have also tried using {!item.Product2Id} but obviously then I have to loop through the new product selections and find their relevant pricebook entries when I save.

 

Any help greatly appreciated :-) 

Message Edited by SidM on 06-12-2009 02:11 PM
SidMSidM

I am pretty sure this is some sort of bug in either the inputField or the actual search lookup dialogue that is preventing me from allowing the user to select a price book entry, in the same way as any other relationship.

 

This is driving me nuts!

 

I've tried every possible way I can think of to do allow the selection of a pricebook entry, but the closest I get is the lookup dialogue with the search box at the top, the title saying "Select a Product" and then the normal full Salesforce UI in the frame below, with the error:

 

Required parameter "Missing the parent_id" not defined.

 

The url the lookup generates is:

 

https://c.cs2.visual.force.com/_ui/common/data/LookupPage?lkfm=j_id0:j_id6&lknm=j_id0:j_id6:table:j_id54:j_id55:1:priceBookEntry&lktp=01u&lksrch=

 

When I create a new OpportunityLineItem, I  use the following code:

 

 

OpportunityLineItem opportunityLineItem = new OpportunityLineItem( OpportunityId = opportunity.Id, PricebookEntryId = new PricebookEntry().Id, etc...

 

Here is a screenshot:

 

 

 

Please help me, anyone?!...

Message Edited by SidM on 06-12-2009 01:37 PM