Skip to main content
Skip table of contents

Create a Button that Displays a Message

Administrators can create Community Hub buttons that display contextually related messages including text and field values. This is done by writing an expression made up of text and field references in the value of a custom label with is added as the success massage to display when a button is clicked.

  1. Write the message expression:
    1. In your favorite text editor, write the expression for the message you want to display in Community Hub when the button is clicked. Example: Got it, thanks. You removed {!nu__Affiliation__c.nu__Account__r.Name} from the roster for: {!nu__Affiliation__c.nu__ParentAccount__r.Name}Learn more (external) about writing expressions.

      Ensure you reference only fields returned by the data source you plan to add to the button.

  2. Create a custom label using the expression in Value:
    1. From Setup, click Create | Custom Labels, click New Custom Label.
    2. In Name, enter a name which meets the following standards:
      • It is written using Pascal Case.
      • It contains 1–4 words.
      • It uses only words in Value.
    3. In Short Description, enter a short description which meets the following standards:
      • It is the value in Name.
      • It is written with spaces between each word.
    4. In Value, enter the text to be displayed in Community Hub.
    5. Click Save.

  3. Create a button that uses a Data Source and the custom label as the Success Label:
    1. In the App Menu, select Community Hub Setup.
    2. In the tab bar, click Buttons.
    3. Click New Button.
    4. In Name, enter an easily recognizable term to identify the button. 
    5. In Description, enter a description of what the button does. 
    6. If you want to grant or revoke access to the button, in Access Control, select the access control which grants the access you want to use.

      Deactivated access controls cannot be selected.

    7. If you want the button to display only when certain conditions are met using an Apex class, in Class, enter the name of the Apex class.

    8. If the button is a primary user action, select Is Primary Action.

      We recommend that a card only have one primary button, with the opportunity for one or more secondary buttons.

    9. In Label, begin typing the name of the custom label you'd like to use for the button text and select it from the list of results or click + to create a new one.

    10. If you want to set where the button displays on a card, in Location, select the location. If nothing is selected, the button displays in the Left position.

      Left—The button displays on the left side of the containing card (default behavior)

      Right—The button displays on the right side of the containing card.

      Block—The button expands to match the width of the containing card.

      Bottom—For Record List Card Types, the button is shown on the bottom of the card, rather than for each item in the list of records.

    11. If you want the button to open the page in a different HTML window target, like in a new tab, in Target, enter the HTML Target value.

    12. In URL, enter the path for the page to which the button should link.

    13. In URL Parameter Key, enter the name of the URL parameter to be passed to the page to which the button links. If you leave URL Parameter Key blank, the default URL parameter is id. As an example, the value in URL is, the value in URL Parameter Key is personid, and the button is provided by a data source the value of 12345 for the personid URL parameter. When the button is clicked, constituents are taken to If you leave URL Parameter Key blank, the default URL parameter is id. In this case, when the button is clicked, constituents are taken to
    14. If you want the button to only display based on certain criteria:

      1. In Object, select the object containing data used to determine whether the button should display.
      2. In Data Source, select the data source that specifies when the button should display. If the data source is based on a SOQL query, be sure to review any tips for making a SOQL query for the entered Class
    15. If you want to trigger custom Javascript behavior when the button is clicked, in On Click, enter the line of Javascript to execute. Learn more about the onClick parameter: apex:commandButton (external).

    16. If you want to trigger custom Javascript behavior after the asynchronous partial postback is complete, in On Complete, enter the line of Javascript to execute. Learn more about the onComplete parameter: apex:commandButton (external).

    17. If you want only certain portions of the page to reload after your button is clicked, in Re Render, enter the id's of the page elements you want to render. Learn more about the reRender parameter: apex:commandButton (external).

    18. If you want the button to display a specific label upon successful submission, in Success Label, enter the name of the label.

    19. Click Save.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.