Skip to main content

Code reviews rule: Missing custom button descriptions

Written by David Martin

Missing custom button descriptions

Why is this an issue?

A custom button runs a URL, a Visualforce page or JavaScript against the record a user is looking at, and its label is rarely enough to say what that does. Descriptions help administrators:

  • Understand what a button does before adding it to a page layout

  • Tell near-identical buttons apart when several exist on one object

Examples

Example of incorrect metadata:

<WebLink>
<fullName>View_Orders</fullName>
<masterLabel>View Orders</masterLabel>
<url>/apex/Orders?id={!Account.Id}</url>
</WebLink>

Example of correct metadata:

<WebLink>
<fullName>View_Orders</fullName>
<description>Opens the order fulfillment console for this account.</description>
<masterLabel>View Orders</masterLabel>
<url>/apex/Orders?id={!Account.Id}</url>
</WebLink>

How can I fix violations?

Add a description saying what the button does and where it sends the user. Set it directly in the button's metadata:

<description>Opens the order fulfillment console for this account.</description>

You can also edit the button in Setup, from Buttons, Links, and Actions in the object's management settings.

When should I disable this rule?

You may dismiss specific violations for buttons with self-explanatory labels where a description would be redundant.

Resources

Did this answer your question?