I know I can click the Related Tab and drill into the Standard Price Book to see it, but it would sure be nice to just show it on the product page. Is this possible?
1 Answer
As a matter of fact, there is a way to do this, although not in the "usual" manner (i.e. adding a field). Instead, you can write a Visualforce page for this:
StandardPriceDisplay.vfp (Label: Standard Price)
<apex:page standardController="Product2" label="Standard Price">
<apex:repeat value="{!Product2.PricebookEntries}" var="entry">
<apex:outputField rendered="{!entry.Pricebook2.IsStandard}" value="{!entry.UnitPrice}" />
</apex:repeat>
</apex:page>
Then, go to the page layout for Products, add the Visualforce page to the layout, change the height to 14 to match the other fields, and show the label. Note: If you use multiple currencies, you will probably want to add an extra criteria to the rendered
attribute to show just the currency of the user.
-
Worked like a charm, of course! Thank you. But why could I not use the usual method of a custom field? Because it's in a different object? May 7, 2018 at 1:59
-
1@ScottCWilson Specifically because it's a child object, and that child object doesn't support triggers/processes/flows.– sfdcfoxMay 7, 2018 at 2:18
-
1First timers needing instructions on creating a VisualForce page should look at this Trailhead page. May 7, 2018 at 2:19