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
Chintan Jadwani 3Chintan Jadwani 3 

Standard New button for Standard Object Product on vf page

Hi,

I have to show New button on Custom VF page. I found a line of code on this forum as below:

<apex:commandButton action="{!URLFOR($Action.Custom_Object__c.New)}" value="New Button"/> and it worked for other objects.

For standard object, it works for Account :<apex:commandButton action="{!URLFOR($Action.Account.New)}" value="New"/>
However, for standard object "Products" it is not working.

I have tried : action="{!URLFOR($Action.Product.New)}" not as action="{!URLFOR($Action.product2.New)}" even.

Can anyone suggest if I am doing wrong?

Thank You.
Chintan
Best Answer chosen by Chintan Jadwani 3
VineetKumarVineetKumar
Try this:
action="{!URLFOR($Action.product2.CreateNewProduct)}"

All Answers

VineetKumarVineetKumar
Try this:
action="{!URLFOR($Action.product2.CreateNewProduct)}"
This was selected as the best answer
Chintan Jadwani 3Chintan Jadwani 3
Thank You Vineet.

It worked. I am not sure why it is different for product only? Any idea?
VineetKumarVineetKumar
API Name for Products is Product2 in salesforce.
You can say that this is a kinda of exception in API naming (few more objects follow this weirdness.. :) )
Chintan Jadwani 3Chintan Jadwani 3
Agree. What about CreateNewProduct in place of just 'New'? Is it also following weirdness? :)