---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideAgentWorkspace (g_aw) - Client

# GlideAgentWorkspace (g_aw) - Client {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 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() {#ariaid-title2}

Closes the currently open record, such as a form, in a subtab within Agent Workspace.
{#gaw-closeRecord__table_mkp_zc3_smb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#gaw-closeRecord__table_mkp_zc3_smb} {#gaw-closeRecord__table_nkp_zc3_smb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#gaw-closeRecord__table_nkp_zc3_smb}  
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) {#ariaid-title3}

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.
{#gaw-openRecord_S_S_O__table_lhq_mph_bhb__entry__3}

| 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. {#gaw-openRecord_S_S_O__ul_py1_mrw_bhb} 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()](https://servicenow-prod.fluidtopics.net/D~Jz7pWgGiVdAfIZ~ZFj8Q#c_GlideFormAPI "The GlideForm API provides methods to customize forms."). |
| 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. {#gaw-openRecord_S_S_O__ul_zxb_xsw_bhb} Default: false |
[Table 3. Parameters]

{#gaw-openRecord_S_S_O__table_lhq_mph_bhb} {#gaw-openRecord_S_S_O__table_mhq_mph_bhb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#gaw-openRecord_S_S_O__table_mhq_mph_bhb}  
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}); 


