Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Create custom UI actions for Agent Workspace

Log in to subscribe to topics and get notified when content changes.

Create custom UI actions for Agent Workspace

Create UI actions to customize Agent Workspace for your organization. With UI actions, you can create custom buttons or menu items and you can also limit agent access to certain forms by user role.

Before you begin

Role required: workspace_admin

About this task

Agent Workspace only supports UI actions for menu items or form buttons. Buttons appear in the top right of the form and menu items appear in the workspace menu in the form.

Procedure

  1. Navigate to System Definition > UI Actions.
  2. Open the UI action that you want to enable for the workspace or create a UI action. The following fields work in both workspace and the platform:
    • Name
    • Table
    • Order
    • Action name
    • Active
    • Show insert
    • Show update
    • Client
    • Hint
    • Condition
    • Script (server scripts only)

    For more information on each field on the UI actions form, see UI actions.

  3. To create a client script for the UI action, select the Client option.

    The system does not check the workspace client script field unless this check box is selected.

  4. To create a server script for the UI action, in the Script field, enter the server script.
    For example, if you want to include the caller name and the short description in an incident that is created from an interaction record, you could use the following script:
    if(current.update()){
    	var inc = new GlideRecord("incident");
    	inc.newRecord();
    	inc.caller_id = current.opened_for;
    	inc.short_description = current.short_description;
    	action.openGlideRecord(inc);
    }

    The system ignores any client scripts that are included in this field. You can only use the workspace client script field for client scripts.

  5. In the Workspace tab, select the Workspace Form Button option or the Workspace Form Menu option.

    The Workspace Client Script field appears.

  6. (Optional) In the Workspace Client Script field, create a workspace-specific client script.
    Workspace has similar client scripting limitations as Service Portal. For example, to open a form by clicking it, you could add the following client script:
    function onClick(g_form) {
    
    }

    For more information on available client scripts for workspace, see Supported client script types and APIs.

  7. In the Requires role tab of the workspace section, add any roles that you want to limit access to the UI action to.
  8. Click Submit or Update.

Using the condition builder to customize UI actions for Agent Workspace

Configure UI actions by adding conditions to a UI Action form.

Example: Using the UI action condition builder

The following condition is configured for the Close Incident button:

Condition statement
For this action to appear on a form, these conditions must evaluate to true:
  • current.incident_state must equal 6: The incident must already be in a Resolved state.
  • gs.hasRole("itil_admin"): The current user must have the itil_admin role.
OR this condition must evaluate to true:
  • gs.getUserID() == current.caller_id: The current user is the user who requested the change.
Note:
  • The current object is not available for conditions on a list context menu. The List context menu option is selected. Any use of current on these actions is ignored.
  • You can reference the parent record for the UI action conditions on a related list button. For example, to disable the New and Edit buttons on the Affected CIs related list for closed changes, copy the global m2m UI actions to the task_ci table and add a condition of parent.active.
  • If you leave one of the fields empty that you specify in your condition statement, that condition defaults to true.
Feedback