Table of Contents


Creating and Managing Buttons

Buttons enable users to perform actions on entity records. Standard buttons like Edit, Delete, and Clone are created automatically, and administrators can create custom buttons that execute URLs or JavaScript code. Buttons can be configured as Detail buttons for individual records or List buttons for multiple records on index pages. Buttons for all entity types, including Salesforce and Dynamics entities, are managed in Magentrix.

Before You Begin

Requirements

To create and manage buttons, users must be assigned a security role with the following permissions:

  • Administrator System Role

Understanding Button Types

Magentrix supports two types of buttons based on where they appear and what they operate on:

Detail Buttons

Detail buttons are displayed on entity detail pages and operate on a single record. When a user is viewing or editing a specific record, detail buttons provide actions relevant to that individual record.

Display Location:

  • On the detail page of a record
  • In the inline actions dropdown menu on list views (when configured as inline actions)

Use Cases:

  • Edit a record
  • Delete a record
  • Clone a record
  • Approve a record
  • Send an email related to the record
  • Generate a document from record data
  • Navigate to a related custom page

Behavior:

  • Operates on the current record being viewed
  • Has access to all field values from the current record
  • Can use formulas to reference record data

List Buttons

List buttons are displayed on entity index pages (where multiple records are listed) and typically operate on the list as a whole or create new records.

Display Location:

  • At the top of the entity index page (Home Tab)
  • Above the list of records

Use Cases:

  • Create a new record
  • Import records
  • Export records to CSV
  • Mass update multiple records (with custom code)
  • Navigate to a custom list view
  • Execute bulk operations

Behavior:

  • Operates on the list or creates new records
  • Does not have access to individual record data
  • Typically performs actions that don't require a specific record context

Understanding Standard vs Custom Buttons

Standard Buttons

Standard buttons are automatically created when an entity is created. They provide core functionality that most entities need.

Common Standard Buttons:

  • Edit: Opens the record in edit mode
  • Delete: Deletes the current record (with confirmation)
  • Clone: Creates a copy of the record
  • New: Creates a new record
  • Account Statement: Entity-specific standard button
  • Allocation: Entity-specific standard button

Characteristics:

  • Automatically created
  • Cannot be deleted
  • Can be hidden by not including them in list layouts or page layouts
  • Indicated by a checked Standard checkbox
  • Provide essential CRUD (Create, Read, Update, Delete) operations

Custom Buttons

Custom buttons are created by administrators to provide additional functionality beyond standard operations.

Characteristics:

  • Created manually by administrators
  • Execute custom URLs or JavaScript code
  • Can be deleted or modified at any time
  • Indicated by an unchecked Standard checkbox
  • Provide organization-specific functionality

Creating a Custom Button

To create a custom button:

  1. In the Setup Home page, click Create > Entities.

  2. Click the Entity for which you want to create a button.

  3. Select the Buttons tab.

  4. Click New.

  5. Configure the button properties in the Button Information section:

    Label: Enter the text that will appear on the button (e.g., "Approve Opportunity", "Generate Quote", "Send Email").

    Name: This field is automatically populated based on the Label. The Name is used when referencing the button via the API.

    Standard: Check this box only if this is a system-standard button. Leave unchecked for custom buttons.

    Entity: This field is automatically populated with the selected entity.

    Description: Enter a description of what the button does (optional but recommended for documentation).

  6. Configure the button behavior in the Additional Details section (see below for detailed configuration).

  7. Configure Advanced Button Settings if needed (see below).

  8. Click Save.

The button is now created and can be added to page layouts or list layouts.

Configuring Button Properties

Label and Name

Label: The user-facing text displayed on the button. Should be clear and action-oriented (e.g., "Approve", "Submit for Review", "Generate PDF").

Name: The API name, automatically generated from the label. Used in code and API references.

Entity Assignment

The button is associated with a specific entity and only appears on that entity's pages.

Description

Optional but recommended. Helps other administrators understand the button's purpose, especially for custom buttons with complex logic.

Configuring Button Behavior

The button's behavior is configured in the Additional Details section:

Button Type

Select whether this button appears on detail pages or list pages:

Detail: The button appears on the detail page of individual records. Users click this button when viewing or editing a specific record. Detail actions are displayed for a single record.

List: The button appears at the top of entity index pages. Users click this button when viewing a list of records. List actions are shown above the list of records.

Content Type

Select what happens when the button is clicked:

URL: The button navigates to a URL or opens a link. The URL can include merge fields to pass record data.

JavaScript: The button executes JavaScript code. This allows for complex custom functionality.

Selection:

  • Choose URL for navigation, opening pages, or calling external services
  • Choose JavaScript for complex logic, calculations, or dynamic behavior

Target

Select where the action opens (applies primarily to URL content type):

--None--: Default behavior (varies by content type)

Existing Window: The action opens in the current browser window, replacing the current page.

New Window: The action opens in a new browser window or tab.

Popup: The action opens in a popup window.

Best Practice: Use "New Window" for external links to keep users in the application. Use "Existing Window" for navigation within the application.

Available as Inline Action

Check Enabled to make this action available to be displayed in lists like Home Tab, List Views, or Related Lists.

When enabled, the button appears in the dropdown menu for each record in list views, providing quick access to detail-level actions without opening the record.

Use Case: Enable for frequently used detail buttons like "Send Email", "Approve", or "Mark Complete".

Obtain Confirmation

Check Enabled if the action should receive a confirmation from the user before the action is activated by end users.

When enabled, users see a confirmation dialog asking them to confirm before the action executes.

Use Case: Enable for destructive actions like custom delete operations, or actions with significant impact like "Submit Final Approval".

Using Formulas in Buttons

Buttons can use formulas to create dynamic behavior based on record data.

Action Formulas

The Action field contains the formula that defines what the button does.

For URL Content Type: Use merge fields to include record data in the URL.

Syntax: Use f(x) notation with Insert Field dropdown and Functions dropdown to build the formula.

Example - Navigate to related record:

f(x) /records/{!AccountId}

This navigates to the Account related to the current record.

Example - Open external system with record ID:

f(x) https://external-system.com/view?id={!RecordId}

For JavaScript Content Type: Write JavaScript code to execute custom logic.

Example - Show alert with record data:

alert('Processing opportunity: ' + {!Name});

Example - Conditional logic:

if ({!Amount} > 10000) {
  // Execute logic for large opportunities
} else {
  // Execute logic for smaller opportunities
}

Visibility Formulas

The Visible field contains a formula that determines whether the button appears.

Purpose: Control when the button is visible based on field values.

Formula Returns: The formula must return true (visible) or false (hidden).

Syntax: Use the same formula format as validation rules with {! and } delimiters.

Example - Show only for specific status:

{!Equal(Status,"Pending Approval")}

The button only appears when Status equals "Pending Approval".

Example - Show for high-value opportunities:

{!GreaterThan(Amount,50000)}

The button only appears when Amount is greater than 50,000.

Example - Complex condition:

{!AND(Equal(Stage,"Negotiation"),NOT(IsNull(CloseDate)))}

The button appears when Stage is "Negotiation" AND Close Date is not blank.

Important: Visibility formulas only evaluate fields that are included in the list layout (for list buttons) or page layout (for detail buttons). If your formula references a field not in the layout, the button may not appear correctly.

Advanced Button Settings

Additional configuration options control button behavior after execution:

Post Action

Select what happens after the button action completes:

Detail View: After the action executes, the user is taken to the record's detail page.

Other options: Additional post-action behaviors may be available depending on the button configuration.

Use Case: Use "Detail View" for actions that modify records and you want users to see the updated record immediately.

Enable Quick Save

Check this option to enable quick save functionality for the button.

When enabled, clicking the button saves the record before executing the button action.

Use Case: Enable for buttons that require the latest saved data to execute correctly.

Disable Save & New

Check this option to disable the "Save & New" functionality.

When enabled, the standard "Save & New" option is not available.

Use Case: Enable for specialized forms where "Save & New" doesn't make sense or would create confusion.

Adding Buttons to Layouts

After creating buttons, they must be added to layouts to be visible to users.

Adding Buttons to List Layouts

  1. Navigate to the Entity's List Layouts tab.

  2. Edit the appropriate list layout (e.g., Home Tab).

  3. In the Buttons & Actions section:

    • Move desired buttons from Available to Selected for the Buttons list (displayed on top of records)
    • Move desired buttons from Available to Selected for the Inline Actions list (displayed in dropdown for each record)
  4. Use up/down arrows to control button order.

  5. Click Save.

Adding Buttons to Page Layouts

Buttons automatically appear on page layouts based on the Buttons Location setting in the page layout configuration (Top Only, Bottom Only, or Both).

All buttons for the entity are available. Use visibility formulas to control which buttons appear for specific records or users.

Editing and Deleting Buttons

To Edit a Button

  1. Navigate to the Entity's Buttons tab.

  2. Click the button you want to edit.

  3. Click Edit.

  4. Make desired changes to button properties.

  5. Click Save.

Impact: Changes take effect immediately. Users will see updated behavior on their next page load.

To Delete a Custom Button

  1. Navigate to the Entity's Buttons tab.

  2. Click the button you want to delete.

  3. Click Delete.

  4. Confirm the deletion.

Important:

  • Only custom buttons can be deleted
  • Standard buttons cannot be deleted
  • Deleted buttons are removed from all layouts
  • This action cannot be undone

Practical Button Examples

Example 1: Approve Opportunity Button

Purpose: Allow managers to approve high-value opportunities.

Configuration:

  • Button Type: Detail
  • Content Type: JavaScript
  • Action: alert('Opportunity approved!'); location.reload();
  • Visible: {!AND(GreaterThan(Amount,50000),Equal(Status,"Pending Approval"))}
  • Available as Inline Action: Enabled

Result: Button appears only on opportunities over $50,000 with Pending Approval status. Clicking approves and refreshes the page.

Example 2: Google Maps Button

Purpose: Open Google Maps with the account's address.

Configuration:

  • Button Type: Detail
  • Content Type: URL
  • Action: https://maps.google.com?q={!BillingStreet},{!BillingCity},{!BillingState}
  • Target: New Window
  • Visible: {!NOT(IsNull(BillingStreet))}

Result: Button opens Google Maps in a new window with the account's billing address, but only if an address exists.

Example 3: Send Email Button

Purpose: Compose an email to the contact.

Configuration:

  • Button Type: Detail
  • Content Type: URL
  • Action: mailto:{!Email}?subject=Regarding {!Name}
  • Target: --None--
  • Visible: {!NOT(IsNull(Email))}

Result: Button opens the user's email client with a pre-filled recipient and subject line, but only if the contact has an email.

Best Practices and Recommendations

  • Use clear labels: Button text should clearly indicate the action (e.g., "Approve", not "OK").
  • Test thoroughly: Test buttons with various record types and field values before deploying.
  • Use visibility formulas strategically: Show buttons only when they're relevant and actionable.
  • Consider mobile users: Button labels should be readable on small screens.
  • Limit button count: Too many buttons clutter the interface. Only add buttons that users truly need.
  • Use inline actions for common tasks: Frequently used detail buttons should be available as inline actions.
  • Document custom JavaScript: Add comments in JavaScript code explaining what it does.
  • Use confirmation for destructive actions: Always enable "Obtain Confirmation" for actions that delete or significantly modify data.
  • Open external links in new windows: Prevents users from losing their place in the application.
  • Test visibility formulas: Ensure formulas reference fields that are on the layout.
  • Follow naming conventions: Use consistent button naming across related entities.
  • Coordinate with permissions: Ensure users have appropriate permissions to perform button actions.

Troubleshooting Tips

Issue: Button not appearing on page layout.

Solution: Verify the button is added to the appropriate list layout or that visibility formulas aren't hiding it. Check that the button type matches where you expect it (Detail vs List).

Issue: Visibility formula not working.

Solution: Ensure the formula references fields that are included in the page layout or list layout. Test the formula with different field values. Check formula syntax.

Issue: JavaScript button not executing.

Solution: Check browser console for JavaScript errors. Verify JavaScript syntax is correct. Ensure merge fields are properly formatted. Test in different browsers.

Issue: URL button navigating to wrong page.

Solution: Check the URL formula. Verify merge fields are correctly referenced with {!FieldName}. Test with records that have different field values.

Issue: Button appears for wrong users.

Solution: Review visibility formulas. Consider if field-level security is affecting visibility. Check that the button is assigned to the correct layouts for different roles.

Issue: Confirmation dialog not appearing.

Solution: Verify that "Obtain Confirmation" is enabled in the button configuration. Save the button and test again.

Issue: Inline action not showing in list view.

Solution: Verify "Available as Inline Action" is enabled. Check that the button is added to the Inline Actions section of the list layout.

Issue: Standard button appearing as custom.

Solution: For custom buttons, this is normal. Standard buttons have the Standard checkbox checked and cannot be deleted.

Issue: Button executes but nothing happens.

Solution: For JavaScript buttons, check if the code is complete. For URL buttons, verify the URL is valid and accessible. Check browser console for errors.

Issue: Too many buttons cluttering the interface.

Solution: Use visibility formulas to show buttons conditionally. Move less frequently used buttons to overflow menus. Consider if all buttons are truly necessary.

     


    See Also


    Jump to Magentrix Entity Checklist

    << Assigning Page Layouts | Managing Salesforce and Dynamics Entities >>