GlideAgentWorkspace (g_aw) - Client

  • Release version: Xanadu
  • Updated August 1, 2024
  • 1 minute to read
  • The g_aw API provides methods that enable a UI action or client script to open a specified record in an Agent Workspace tab.

    There is no constructor for this class. Access GlideAgentWorkspace methods using the g_aw global object.

    GlideAgentWorkspace - closeRecord()

    Closes the currently open record, such as a form, in a subtab within Agent Workspace.

    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    None
    The following example saves the content of the tab and then closes it.
    function onClick(g_form) {
    function onClick(g_form) {
      g_form.save().then(function(){
        g_aw.closeRecord();
      });
    }

    GlideAgentWorkspace - openRecord(String table, String sysId, Object params)

    Opens a specified record, such as a form, in a subtab within Agent Workspace.

    Note:
    This method is only available in the Agent Workspace client scripting environment or in a UI action on the workspace client script field.
    Table 3. Parameters
    Name Type Description
    table String Name of the table that contains the record to open.
    sysId String Sys ID of the record to open.
    params Object Optional. Name/value pairs of the parameters to pass to the record.
    "params": {
      "readOnlyForm": Boolean;
      "defaultTab": "String";
      "hideDetails": Boolean
    }
    params.readOnlyForm Boolean Flag that indicates whether all fields on the opened record are read-only; regardless of the UI policy and ACLs.
    • true: All fields are read only.
    • false: Fields adhere to the associated UI policy and ACLs.

    Default: false

    params.defaultTab String Name of the initial tab to display in the workspace. You can only specify related items or related lists.

    If not specified, the details tab appears unless hideDetails is set to true.

    For more information on the method to use to obtain a related list name, see getRelatedListNames().

    params.hideDetails Boolean Flag that indicates whether to hide the details tab and the UI actions.
    • true: Only the form header, all other tabs, and the first available tab appear on the form.
    • false: Details tab and UI actions appear on the form.

    Default: false

    Table 4. Returns
    Type Description
    None

    Open a sys_user record in a subtab.

    g_aw.openRecord('sys_user', '62826bf03710200044e0bfc8bcbe5df1'); 

    Open a record in a subtab where all fields are read-only.

    g_aw.openRecord('sys_user', '62826bf03710200044e0bfc8bcbe5df1', {readOnlyForm: true}); 

    Open a record in a subtab and go directly to the "Groups" related list.

    g_aw.openRecord('sys_user', '62826bf03710200044e0bfc8bcbe5df1', {defaultTab: "sys_user_grmember.user"});  

    Open a record in a subtab but only show the form header and other tabs.

    g_aw.openRecord('sys_user', '62826bf03710200044e0bfc8bcbe5df1', {hideDetails: true});