Actions and Links

You can add actions, such as buttons and menu items, to detail pages, list pages, and so on. You can also create special fields, rendered as links, that are displayed with other fields throughout the application.

You can base an action on a script (a Groovy method that's defined on the object) or on a URL defined by a script. After you create an action, it can be exposed as a button or an option on the Actions menu. A button can perform an action or navigate the user to another page in the runtime application, or to another Web site. For example, you might want to include a button on a summary table, which users can click at runtime to create a new type of record from a selected row, such as escalating an existing "trouble ticket" to a more severe "case" that can be managed separately.

After creating a link, you can select it as a field for display at runtime. For example, you might want to provide a static link from an overview page to a corporate Web site.

Add Actions or Links

You add actions or links in two steps:

  1. Define an action or link for an object.

  2. Add that action or link to a page layout.

    You can also manage the Actions menu by hiding or showing menu items, rearranging the action groupings or display sequence, and managing the toolbar by hiding or showing icons and buttons.

Note: Custom actions with Save and Close and Save and Edit are only available for the below objects:
  • Service Request
  • Business Plan
  • Sales Objective
  • Opportunity

Define Actions or Links

To define an action or link for an object:

  1. On the main Overview page in Application composer, select a standard or custom object in the object tree.

  2. Select the Actions and Links node.

  3. In the Create Action or Link page, enter a descriptive name in the Display Label field.

  4. In the Type field, select either Action or Link.

  5. In the Source field, select either Script or URL.

  6. In the Script region click the New icon to build your script.

    • If the source is a URL, you can enter a static URL enclosed in double quotation marks. Or, you can define the URL by using the expression builder, which provides access to this object's fields to assist you in constructing the URL. If this object has a parent or relationship with a source object, then optionally change the context to access another object's fields for URL definition.

      Any new functions that you create will be added to the Method Name choice list. If functions were already created for the object, then you can select one of them from the Method Name choice list. Object functions that are created elsewhere through other flows, such as server scripts, can also be used here.

      To switch the context to the object's parent or related source object, for access to the object's fields for the URL definition, check the Select alternative context check box.

      Note: Since the script deriving the URL can execute multiple times during the page life cycle, ensure that your script is safe to run multiple times. For example, don't write custom business logic to update object records.
    • If the source is a script, you can either select a predefined object function from the Method Name choice list, or create a new object function using the expression builder. Any new functions that you create will be added to the Method Name choice list.

      If functions were already created for the object, then you can select one of them from the Method Name choice list. Object functions that are created elsewhere through other flows, such as server scripts, can also be used here.

      Note: Avoid writing a process-intensive script that references external web services. Repeated executions of such scripts can cause errors and potentially degrade performance.

      When creating custom actions based on a script for top-level custom objects, you can specify how you would like the action to conclude at runtime, after the script completes:

      • Save the record and return to the previous page (save and close)

      • Save and continue editing the record (save and continue)

      • Perform the action but don't save the record (run the script only)

      Note: You can also specify this same information for standard objects, although some standard objects don't support the "save and close" and "save and continue" options. If you use one of these options with an unsupported standard object, then you won't be able to select and add this action to a page layout.

Display Actions or Links on Pages

After you save actions or links, you can expose them on page layouts.

When displaying a link, you select it just as you select to display standard or custom fields. This is because, at runtime, the UI displays the URL link as if it's a field in a table.

You can add actions to two places in the UI: on the toolbar as a button and in the Actions menu for a table.

Tip: To support functions that don't need to be displayed prominently on the page, add actions as options on the Actions menu. To support key functions that are frequently executed by your users, add actions as buttons.When displaying actions as buttons, be sure to test your page at runtime (in all supported languages) to confirm that the presentation of buttons is as expected. Button display could be unexpected due to the available space on the page at runtime, the number of buttons on the page, and button width (which depends on label length). If you add more buttons than the toolbar has space, then at runtime the buttons are stacked and made available using a drop-down button.

You can display actions as either buttons or Actions menu items in a variety of locations:

  • Summary table on the overview page

  • Default summary on the details page

  • Summary table on a details page's subtab

  • Revenue table on the details page for the opportunity object

Note: If you add a custom button to a table and, at runtime, that table has no rows, then the button is automatically disabled.

You can display links for an object in a variety of locations in that object's work area. You can add a link wherever you can add a field. Possible locations include, but aren't limited to:

  • As a column in the summary table on the overview page

  • Default summary on the details page

  • As a column in the summary table on a details page's subtab

  • In the detail form under the summary table on a details page's subtab

  • As a column in the summary table on a tree node page for a child object

  • As a column in the revenue table on the details page for the opportunity object

Delete Unpublished Actions and Links

You can use Application Composer to delete any unpublished actions and links. Any exposure of the actions (as UI buttons or action menus) and links (as fields) in the same object's extensible pages or as a detailed subtab under another object's page are also automatically deleted.

To delete unpublished actions or links for an object:

  1. On the main Overview page in Application Composer, expand the standard or custom object whose actions or links you want to delete.

  2. Select the Actions and Links node.

    Application Composer lists all the actions and links defined for the selected object.

  3. Select the action or link that you want to delete and click the delete icon.

  4. Click OK on the confirmation dialog.

  5. To verify that the deleted actions and links no longer appear in the object's pages, click the Pages node and review the page layouts.

Points to Consider

When defining actions, here are some important points to consider:

  • If you define a custom action and expose it on a list, ensure that you do the following:

    1. Include a check for the active record row, and ensure that the UI supports users selecting any record as the active row before invoking the custom action.

    2. Test the performance of the script behind the action. Actions on the list page are synchronous calls which means that long-running scripts will block the page from displaying.

  • Don't create custom buttons to populate the mandatory or required fields on the UI. End users must enter the values in the mandatory fields manually.

  • Avoid creating an action that, when invoked from a record, calls an external web service to update the same record currently open. Instead, consider calling the external web service asynchronously using an object workflow.