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
Emilien Guichard 40Emilien Guichard 40 

Advanced Apex Superbadge Step 3 - List Price not editable

Hi there,

I'm facing an issue at the step 3 of the Advanced Apex Superbadge, on the Product2New page the List Price is not editable :

User-added image

In the Visualforce page I'm using :
<apex:column headerValue="{!$ObjectType.PriceBookEntry.fields.UnitPrice.label}" >
    <inputField value="{!p.pricebookEntryRecord.UnitPrice}" />
</apex:column>
and in the controller extension class Product2Extension, here is my wrapper :
public class ProductWrapper {
        public Product2 productRecord {get; set;}
        public PriceBookEntry pricebookEntryRecord {get; set;}
        
        public productWrapper() {
            productRecord = new product2(Initial_Inventory__c = 0);
            pricebookEntryRecord = new pricebookEntry();
        }
}
Any piece of advice to get this working ?

Thanks a lot !


 
Best Answer chosen by Emilien Guichard 40
jigarshahjigarshah
List Price is a mandatory field by default and hence it appears as required. You can do the following to work around the required field mandate.
  1. You can only have one record onstead of showing multiple entries if that is doable.
  2. Ensure there is a default price value (maybe 0.0) populated in every List Price field so that required field mandate is taken care of.

All Answers

jigarshahjigarshah
  • Your inputField tag in Visualforce code needs to be updated with the "apex:" as follows. I am not sure if this is a typo or a miss but wanted to highlight this because I also do not see the List Price field rendered in the screenshot.
<apex:inputField value="{!p.pricebookEntryRecord.UnitPrice}" />
  • Moreover, you may want to check if the Profile of the Salesforce user account through which the page is being developed has Edit permissions on the List Price field.
  • You also want to check if the Use Standard Price field is set to true which means the Price listed on the entry is derived from the Standard Proce Book and may be unavailable for modification.
  • You may also want to check if the Active field for that respective PriceBookEntry object is set to true.
Emilien Guichard 40Emilien Guichard 40
Hi jigarshah,
Thanks for your answer and also good catch ! 

I changed the inputfield to apex:inputfield and now the field is editable but it is always mandatory even for the lines that are not filled :

User-added image

Do you have any idea on how to be able to insert only the not empty lines ?
jigarshahjigarshah
List Price is a mandatory field by default and hence it appears as required. You can do the following to work around the required field mandate.
  1. You can only have one record onstead of showing multiple entries if that is doable.
  2. Ensure there is a default price value (maybe 0.0) populated in every List Price field so that required field mandate is taken care of.
This was selected as the best answer
Emilien Guichard 40Emilien Guichard 40
Awesome !
Thanks a lot.