0

I would like to remove the standard "Save & Add Price" Button from the new product page layout IF the product is of a certain record type. How would I achieve this?

1

This is not going to be trivial

  • Create a VF page that overrides the New button for Product. Create a corresponding controller extension class.
  • Include all the fields that your users would get for free from the standard page layout. Mimic the required fields that the standard page layout supports. As new Product2 fields are added, you will need to maintain this VF page too. Fieldsets can make this somewhat easier.
  • Include apex:commandButton for each of the OOB buttons - Save, Save & Add price, and Cancel. There is no URLFOR expression you can use for the Save & Add Price action so you will have to use the controller to do the redirect via an action method as the URL requires the Product2 ID: /pbk/addStandardPrice.jsp?id=theProduct2Id&retURL=/theProduct2Id&ap=1
  • Dynamically display the save & add price button depending on Record Type by using a rendered= attribute on the apex:commandButton

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.