---
sourceDocument: Zurich API Reference
sourceDocumentLink: https://www.servicenow.com/docs/r/zurich/api-reference

 Release :

    - zurich

ft:locale :

    - en-US

ft:publication_title :

    - Zurich API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideForm (Next Experience) - Client

# GlideForm (Next Experience) - Client {#ariaid-title1}

* Release version: Zurich
* 
* Updated July 31, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 42 minutes to read

The GlideForm API provides methods to customize forms in the Next Experience UI Framework.

Only use GlideForm methods on the client. You can use these methods to make custom changes to the form view of records. All validation of examples was done using client scripts.

You can also use some of these methods in other client scripts (such as Catalog Client Scripts or Wizard Client Scripts), but you must first test this to determine whether they will work as expected.  
Note:  
The methods getControl(), getHelpTextControl(), getElement(), and getFormElement() are deprecated for mobile devices. For information on using GlideForm for mobile, see [Mobile Client GlideForm (g_form) Scripting and Migration](https://www.servicenow.com/docs/ZhoTp1yZOPaSfQTt73bR_g "Client scripting for mobile is identical to scripting for the web, with some exceptions. All new scripts must conform to certain guidelines. The following items are affected on the mobile platform: client scripts, UI policies, navigator modules, and UI actions.").

There is no constructor for the GlideForm class. Access GlideForm methods using the `g_form` global object.

## GlideForm (Next Experience) - addAdditionalParams(String parameterName, String value) {#ariaid-title2}

Adds a hidden input with given name and value parameter to the form.
{#GFNX-addAdditionalParams_S_S__table_kk2_j1h_5fc__entry__3}

| Name | Type | Description |
|-|-|-|
| parameterName | String | Name of the parameter to add. |
| value | String | Value of the parameter to add. |
[Table 1. Parameters]

{#GFNX-addAdditionalParams_S_S__table_kk2_j1h_5fc} {#GFNX-addAdditionalParams_S_S__table_lk2_j1h_5fc__entry__2}

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

{#GFNX-addAdditionalParams_S_S__table_lk2_j1h_5fc}  
The following example customizes the behavior of the Update button on the Incident form so that users are redirected back to the list view in the default view, but remain on the record
in the Advanced View after saving.


    // Create an onLoad client script for the incident table with the following script.

    function onLoad() {
       g_form.addAdditionalParam('view_name', g_form.getViewName());
    }

Edit the global `sysverb_update` UI action and add the following script.

    current.update();
    if (RP.getParameterValue("view_name") == "advanced") {
      // Keep the record open if saving from the advanced view
      action.openGlideRecord(current);

    // To test:
    // Open the incident list and edit an incident. Click Update to be redirected to the list.
    // Open /incident_list.do?sysparm_view=advanced and edit an incident. Click Update to be redirected back to the edited incident.

## GlideForm (Next Experience) - addChoice(String fieldName, String choiceValue, String choiceLabel) {#ariaid-title3}

Adds a choice to the end of a specified choice list field.
{#GFNX-addChoice_S_S_S__table_omk_pgd_5s__entry__3}{#GFNX-addChoice_S_S_S__g_form-addOption-fieldName-entry}{#GFNX-addChoice_S_S_S__g_form-addOption-choiceValue-entry}{#GFNX-addChoice_S_S_S__g_form-addOption-choiceLabel-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field in which to add the choice field option. |
| choiceValue | String | Value to store in the database. |
| choiceLabel | String | Value to display. |
[Table 3. Parameters]

{#GFNX-addChoice_S_S_S__table_omk_pgd_5s} {#GFNX-addChoice_S_S_S__table_pmk_pgd_5s__entry__2}

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

{#GFNX-addChoice_S_S_S__table_pmk_pgd_5s}  

    g_form.addChoice('priority', '6', '6 - Really Low');

## GlideForm (Next Experience) - addDecoration(String fieldName, String icon, String title) {#ariaid-title4}

Adds an icon on a field's label.
Adding the same item twice is prevented; however, you can add the same icon with a different title.  
Note:  
This method is not supported by Service Catalog.
{#GFNX-addDecoration_S_S_S__table_vyw_1dw_ts__entry__3}{#GFNX-addDecoration_S_S_S__g_form-add_decor-fieldName-entry}{#GFNX-addDecoration_S_S_S__g_form-add_decor-icon-entry}{#GFNX-addDecoration_S_S_S__g_form-add_decor-title-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name. |
| icon | String | Name of the icon to show next to the specified field. Valid values: * icon-add * icon-alert * icon-book * icon-book-open * icon-calendar * icon-cards * icon-cart-full * icon-catalog * icon-check-circle * icon-cog * icon-comment * icon-console * icon-dashboard * icon-database * icon-delete * icon-drawer * icon-edit * icon-filter * icon-folder * icon-form * icon-help * icon-home * icon-image * icon-info * icon-label * icon-lightbulb * icon-list * icon-livefeed * icon-locked * icon-mail * icon-mobile * icon-new-ticket * icon-paperclip * icon-power * icon-script * icon-search * icon-sort-ascending * icon-star * icon-star-empty * icon-tab * icon-trash * icon-tree * icon-tree-right * icon-user * icon-user-group * icon-view {#GFNX-addDecoration_S_S_S__ul_p2d_sqg_5fc} |
| title | String | Title for the icon. |
[Table 5. Parameters]

{#GFNX-addDecoration_S_S_S__table_vyw_1dw_ts} {#GFNX-addDecoration_S_S_S__table_wyw_1dw_ts__entry__2}

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

{#GFNX-addDecoration_S_S_S__table_wyw_1dw_ts}  

    g_form.addDecoration('caller_id', 'icon-star', 'preferred member');

## GlideForm (Next Experience) - addDecoration(String fieldName, String icon, String title, String color) {#ariaid-title5}

Adds an icon on a field's label.
Adding the same item twice is prevented; however, you can add the same icon with a different title.  
Note:  
This method is not supported by Service Catalog.
{#GFNX-addDecoration_S_S_S_S__table_gzh_fyd_5s__entry__3}{#GFNX-addDecoration_S_S_S_S__g_form-add_decor-fieldName-entry}{#GFNX-addDecoration_S_S_S_S__g_form-add_decor-icon-entry}{#GFNX-addDecoration_S_S_S_S__g_form-add_decor-title-entry}{#GFNX-addDecoration_S_S_S_S__g_form-add_decor-color-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name. |
| icon | String | Name of the icon to show next to the specified field. Valid values: * icon-add * icon-alert * icon-book * icon-book-open * icon-calendar * icon-cards * icon-cart-full * icon-catalog * icon-check-circle * icon-cog * icon-comment * icon-console * icon-dashboard * icon-database * icon-delete * icon-drawer * icon-edit * icon-filter * icon-folder * icon-form * icon-help * icon-home * icon-image * icon-info * icon-label * icon-lightbulb * icon-list * icon-livefeed * icon-locked * icon-mail * icon-mobile * icon-new-ticket * icon-paperclip * icon-power * icon-script * icon-search * icon-sort-ascending * icon-star * icon-star-empty * icon-tab * icon-trash * icon-tree * icon-tree-right * icon-user * icon-user-group * icon-view {#GFNX-addDecoration_S_S_S_S__ul_p2d_sqg_5fc} |
| title | String | Title for the icon. |
| color | String | CSS color. |
[Table 7. Parameters]

{#GFNX-addDecoration_S_S_S_S__table_gzh_fyd_5s} {#GFNX-addDecoration_S_S_S_S__table_hzh_fyd_5s__entry__2}

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

{#GFNX-addDecoration_S_S_S_S__table_hzh_fyd_5s}  

    g_form.addDecoration('caller_id', 'icon-star', 'Mark as Favorite', 'color-green');

## GlideForm (Next Experience) - addErrorMessage(String message) {#ariaid-title6}

Displays the specified error message at the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addErrorMessage_S__table_fyn_vnd_5s__entry__3}{#GFNX-addErrorMessage_S__g_form-add_err_msg-message-entry}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display. |
[Table 9. Parameters]

{#GFNX-addErrorMessage_S__table_fyn_vnd_5s} {#GFNX-addErrorMessage_S__table_gyn_vnd_5s__entry__2}

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

{#GFNX-addErrorMessage_S__table_gyn_vnd_5s}  

    g_form.addErrorMessage('This is an error');

## GlideForm (Next Experience) - addFormMessage(String message, String type, Object options) {#ariaid-title7}

Displays a floating form message at the top of the form detail section. The message doesn't cover UI actions.
See also:

* [clearAllFormMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearAllFormMessages "Removes all form messages of any type.")
* [clearFormMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearFormMessages_S "Removes all form messages of a specified type.")
{#GFNX-addFormMessage_S_S__ul_unz_vkt_4pb}
{#GFNX-addFormMessage_S_S__table_f2v_zym_4pb__entry__3}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-message-entry}{#GFNX-addFormMessage_S_S__glideform-parm-type-entry}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-options-entry}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-options_buttons-entry}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-options_buttons_actionName-entry}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-options_buttons_label-entry}{#GFNX-addFormMessage_S_S__g_form-add_form_msg-options_meta-entry}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display. |
| type | String | Type of message. Valid values: * error * info * warning {#GFNX-addFormMessage_S_S__ul_mgd_sqg_5fc} |
| options | Object | Optional. Buttons to add to the form message and any metadata needed to handle a button click. { buttons: [Array], meta: {Object} } |
| options.buttons | Array | List of buttons to add to the form message. buttons: [ { actionName: "String", label: "String" } ] |
| options.buttons.actionName | String | Name used by the `FORM_MESSAGE_BUTTON_CLICKED` event handlers to determine the button that was clicked. For example, if you add a button with the actionName `assign_to_me`, you must create an event handler in UIB on the `FORM_MESSAGE_BUTTON_CLICKED` event that only executes when the actionName is `assigned_to_me`. |
| options.buttons.label | String | Text to display on the button. |
| options.meta | Object | Map of any metadata needed to handle the button click formatted as key-value pairs. meta: { 'key': 'value' } For example, for an Assign to me button the event handler needs the sys_id of the user to assign the record to. |
[Table 11. Parameters]

{#GFNX-addFormMessage_S_S__table_f2v_zym_4pb} {#GFNX-addFormMessage_S_S__table_g2v_zym_4pb__entry__2}

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

{#GFNX-addFormMessage_S_S__table_g2v_zym_4pb}  
The following example shows how to add form messages of each type.

    g_form.addFormMessage('info message','info');
    g_form.addFormMessage('warning message','warning');
    g_form.addFormMessage('error message','error');
    g_form.addFormMessage('info2 message','info');
    g_form.addFormMessage('warning2 message','warning');
    g_form.addFormMessage('error2 message','error');
    g_form.addFormMessage('Would you like to reassign this to yourself?', 'info', {buttons: [{label: "Assign to me", actionName: "assign_to_me"}], meta: {'userId': '46d44a23a9fe19810012d100cca80666'}});

## GlideForm (Next Experience) - addInfoMessage(String message) {#ariaid-title8}

Adds the specified informational message to the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addInfoMessage_S__table_pcg_n4d_5s__entry__3}{#GFNX-addInfoMessage_S__g_form-add_info_msg-message-entry}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display. |
[Table 13. Parameters]

{#GFNX-addInfoMessage_S__table_pcg_n4d_5s} {#GFNX-addInfoMessage_S__table_qcg_n4d_5s__entry__2}

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

{#GFNX-addInfoMessage_S__table_qcg_n4d_5s}  

    g_form.addInfoMessage('The top five fields in this form are mandatory');

## GlideForm (Next Experience) - addHighMessage(String message) {#ariaid-title9}

Displays a high priority message at the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addHighMessage_S__table_ft2_hk4_2fc__entry__3}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display on the form. |
[Table 15. Parameters]

{#GFNX-addHighMessage_S__table_ft2_hk4_2fc} {#GFNX-addHighMessage_S__table_gt2_hk4_2fc__entry__2}

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

{#GFNX-addHighMessage_S__table_gt2_hk4_2fc}  
The following example shows how to display a high priority message at the top of the form.

    g_form.addHighMessage("This is a high priority message");

## GlideForm (Next Experience) - addLowMessage(String message) {#ariaid-title10}

Displays a low priority message at the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addLowMessage_S__table_ydn_fj4_2fc__entry__3}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display on the form. |
[Table 17. Parameters]

{#GFNX-addLowMessage_S__table_ydn_fj4_2fc} {#GFNX-addLowMessage_S__table_zdn_fj4_2fc__entry__2}

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

{#GFNX-addLowMessage_S__table_zdn_fj4_2fc}  
The following example shows how to display a low priority message at the top of the form.

    g_form.addLowMessage("This is a low priority message "); 

## GlideForm (Next Experience) - addModerateMessage(String message) {#ariaid-title11}

Displays a moderate priority message at the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addModerateMessage_S__table_kfb_vj4_2fc__entry__3}

| Name | Type | Description |
|-|-|-|
| message | String | Message to display on the form. |
[Table 19. Parameters]

{#GFNX-addModerateMessage_S__table_kfb_vj4_2fc} {#GFNX-addModerateMessage_S__table_lfb_vj4_2fc__entry__2}

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

{#GFNX-addModerateMessage_S__table_lfb_vj4_2fc}  
The following example shows how to display a moderate priority message at the top of the form.

    g_form.addModerateMessage("This is a moderate priority message");

## GlideForm (Next Experience) - addOption(String fieldName, String choiceValue, String choiceLabel) {#ariaid-title12}

Adds a choice to the end of a specified choice list field.
{#GFNX-addOption_S_S_S__table_omk_pgd_5s__entry__3}{#GFNX-addOption_S_S_S__g_form-addOption-fieldName-entry}{#GFNX-addOption_S_S_S__g_form-addOption-choiceValue-entry}{#GFNX-addOption_S_S_S__g_form-addOption-choiceLabel-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field in which to add the choice field option. |
| choiceValue | String | Value to store in the database. |
| choiceLabel | String | Value to display. |
[Table 21. Parameters]

{#GFNX-addOption_S_S_S__table_omk_pgd_5s} {#GFNX-addOption_S_S_S__table_pmk_pgd_5s__entry__2}

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

{#GFNX-addOption_S_S_S__table_pmk_pgd_5s}  

    g_form.addOption('priority', '6', '6 - Really Low');

## GlideForm (Next Experience) - addOption(String fieldName, String choiceValue, String choiceLabel, Number choiceIndex) {#ariaid-title13}

Adds a choice to the list field at the position specified.
Note:  
Duplicate list labels are not supported in Service Portal. For example, items with label text matching another label are ignored and not added to the list.
{#GFNX-addOption_S_S_S_N__table_k5s_qhd_5s__entry__3}{#GFNX-addOption_S_S_S_N__g_form-addOption-fieldName-entry}{#GFNX-addOption_S_S_S_N__g_form-addOption-choiceValue-entry}{#GFNX-addOption_S_S_S_N__g_form-addOption-choiceLabel-entry}{#GFNX-addOption_S_S_S_N__g_form-addOption-choiceIndex-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field in which to add the choice field option. |
| choiceValue | String | Value to store in the database. |
| choiceLabel | String | Value to display. |
| choiceIndex | Number | Order of the choice in the list. The index is a zero-based array. |
[Table 23. Parameters]

{#GFNX-addOption_S_S_S_N__table_k5s_qhd_5s} {#GFNX-addOption_S_S_S_N__table_l5s_qhd_5s__entry__2}

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

{#GFNX-addOption_S_S_S_N__table_l5s_qhd_5s}  

    g_form.addOption('priority', '2.5', '2.5 - Moderately High', 3);

## GlideForm (Next Experience) - addSuccessMessage(String message) {#ariaid-title14}

Displays a message confirming a successful action at the top of the form.
This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.
{#GFNX-addSuccessMessage_S__table_mln_jh4_2fc__entry__3}

| Name | Type | Description |
|-|-|-|
| message | String | Success message to display. |
[Table 25. Parameters]

{#GFNX-addSuccessMessage_S__table_mln_jh4_2fc} {#GFNX-addSuccessMessage_S__table_nln_jh4_2fc__entry__2}

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

{#GFNX-addSuccessMessage_S__table_nln_jh4_2fc}  
The following example shows how to display a message confirming a success message at the top of the form.

    g_form.addSuccessMessage("This is a success message");

## GlideForm (Next Experience) - clearAllFormMessages() {#ariaid-title15}

Removes all form messages of any type.
See also:

* [GlideForm (Next Experience) - addFormMessage(String message, String type, Object options)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-addFormMessage_S_S "Displays a floating form message at the top of the form detail section. The message doesn't cover UI actions.")
* [GlideForm (Next Experience) - clearMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearMessages "Removes all informational and error messages from the top of the form.")
* [clearFormMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearFormMessages_S "Removes all form messages of a specified type.")
{#GFNX-clearAllFormMessages__ul_unz_vkt_4pb}
{#GFNX-clearAllFormMessages__table_qpm_dzm_4pb__entry__3}

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

{#GFNX-clearAllFormMessages__table_qpm_dzm_4pb} {#GFNX-clearAllFormMessages__table_rpm_dzm_4pb__entry__2}

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

{#GFNX-clearAllFormMessages__table_rpm_dzm_4pb}  
The following example shows how to clear all messages from the form.

    g_form.clearAllFormMessages();

## GlideForm (Next Experience) - clearChoices(String fieldName) {#ariaid-title16}

Removes all choices in a specified choice list field.
{#GFNX-clearChoices_S__table_ewl_xxs_rfc__entry__3}

|   |   |   |
|-|-|-|
| fieldName | String | Name of the field for which to clear the full list of choices. |
[Table 29. Parameters]

{#GFNX-clearChoices_S__table_ewl_xxs_rfc} {#GFNX-clearChoices_S__table_cdt_v3d_5s__entry__2}

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

{#GFNX-clearChoices_S__table_cdt_v3d_5s}  

    g_form.clearChoices('priority');

## GlideForm (Next Experience) - clearFormMessages(String type) {#ariaid-title17}

Removes all form messages of a specified type.
See also:

* [GlideForm (Next Experience) - addFormMessage(String message, String type, Object options)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-addFormMessage_S_S "Displays a floating form message at the top of the form detail section. The message doesn't cover UI actions.")
* [GlideForm (Next Experience) - clearMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearMessages "Removes all informational and error messages from the top of the form.")
* [GlideForm (Next Experience) - clearAllFormMessages()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-clearAllFormMessages "Removes all form messages of any type.")
{#GFNX-clearFormMessages_S__ul_unz_vkt_4pb}
{#GFNX-clearFormMessages_S__table_ilw_bzm_4pb__entry__3}{#GFNX-clearFormMessages_S__glideform-parm-type-entry}

| Name | Type | Description |
|-|-|-|
| type | String | Type of message. Valid values: * error * info * warning {#GFNX-clearFormMessages_S__ul_mgd_sqg_5fc} |
[Table 31. Parameters]

{#GFNX-clearFormMessages_S__table_ilw_bzm_4pb} {#GFNX-clearFormMessages_S__table_jlw_bzm_4pb__entry__2}

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

{#GFNX-clearFormMessages_S__table_jlw_bzm_4pb}  
The following example shows how to clear all error messages from the form.

    g_form.clearFormMessages('error');

## GlideForm (Next Experience) - clearMessages() {#ariaid-title18}

Removes all informational and error messages from the top of the form.
Removes informational and error messages added with g_form.addInfoMessage() and g_form.addErrorMessage().
{#GFNX-clearMessages__table_krr_y4d_5s__entry__3}

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

{#GFNX-clearMessages__table_krr_y4d_5s} {#GFNX-clearMessages__table_lrr_y4d_5s__entry__2}

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

{#GFNX-clearMessages__table_lrr_y4d_5s}  

    g_form.clearMessages();

## GlideForm (Next Experience) - clearOptions(String fieldName) {#ariaid-title19}

Removes all options from the specified choice list.
{#GFNX-clearOptions_String__table_bdt_v3d_5s__entry__3}{#GFNX-clearOptions_String__g_form-clearOptions-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field for which to clear the choice options. |
[Table 35. Parameters]

{#GFNX-clearOptions_String__table_bdt_v3d_5s} {#GFNX-clearOptions_String__table_cdt_v3d_5s__entry__2}

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

{#GFNX-clearOptions_String__table_cdt_v3d_5s}  

    g_form.clearOptions('priority');

## GlideForm (Next Experience) - clearValue(String fieldName) {#ariaid-title20}

Removes any value(s) from the specified field.
{#GFNX-clearValue_String__table_tlr_znc_5s__entry__3}{#GFNX-clearValue_String__g_form-clearValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field to clear. |
[Table 37. Parameters]

{#GFNX-clearValue_String__table_tlr_znc_5s} {#GFNX-clearValue_String__table_ulr_znc_5s__entry__2}

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

{#GFNX-clearValue_String__table_ulr_znc_5s}

## GlideForm (Next Experience) - disableAttachments() {#ariaid-title21}

Prevents file attachments from being added to the form.
This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-disableAttachments__table_ggk_bqd_5s__entry__3}

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

{#GFNX-disableAttachments__table_ggk_bqd_5s} {#GFNX-disableAttachments__table_hgk_bqd_5s__entry__2}

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

{#GFNX-disableAttachments__table_hgk_bqd_5s}

## GlideForm (Next Experience) - disableChoice(String fieldName, String choiceValue) {#ariaid-title22}

Programmatically disables a specific choice in the drop-down field, if the choice exists. No changes are made if the choice is already disabled.
{#GFNX-disableChoice_S_S__table_q2s_gds_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name of the choice to disable. Data type: String |
| choiceValue | String | Value of the choice to disable. Data type: String |
[Table 41. Parameters]

{#GFNX-disableChoice_S_S__table_q2s_gds_rfc} {#GFNX-disableChoice_S_S__table_fvm_xbs_rfc__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the given choice is disabled or active in the form. Valid values: * true: Choice is disabled. * false: Option is already disabled or is not found. Data type: Boolean |
[Table 42. Returns]

{#GFNX-disableChoice_S_S__table_fvm_xbs_rfc}  
The following example calls disableChoice() to disables the loading_dock choice in the delivery_location form field.

    if (g_form.getValue('address_type') == 'home') {
    	g_form.disableChoice('delivery_location', 'loading_dock');
    }

    // Only itil_admin users can select the "Closed" option  

    function onLoad() {
    	if (g_user.hasRole('itil_admin')) return;

    	if (g_form.getValue('incident_state') != '7')
    		g_form.disableChoice('incident_state', 7);

    	if (g_form.getValue('state') != '7') {
    		g_form.disableChoice('state', 7);
    	}

    }

## GlideForm (Next Experience) - enableAttachments() {#ariaid-title23}

Allows file attachments to be added to the form. Shows the paper clip icon.
This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-enableAttachments__table_i3c_ppd_5s__entry__3}

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

{#GFNX-enableAttachments__table_i3c_ppd_5s} {#GFNX-enableAttachments__table_j3c_ppd_5s__entry__2}

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

{#GFNX-enableAttachments__table_j3c_ppd_5s}

## GlideForm (Next Experience) - enableChoice(String fieldName, String choiceValue) {#ariaid-title24}

Programmatically enables a specific choice in the drop-down field, if the choice exists. No changes are made if the option is already enabled.
{#GFNX-enableChoice_S_S__table_q2s_gds_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name of the choice to enable. |
| choiceValue | String | Value of the choice to enable. |
[Table 45. Parameters]

{#GFNX-enableChoice_S_S__table_q2s_gds_rfc} {#GFNX-enableChoice_S_S__table_fvm_xbs_rfc__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the given choice is successfully enabled. Valid values: * true: Choice is enabled. * false: Choice is already enabled or is not found. {#GFNX-enableChoice_S_S__ul_sxx_tcs_rfc} Data type: Boolean |
[Table 46. Returns]

{#GFNX-enableChoice_S_S__table_fvm_xbs_rfc}  
The following example calls enable() to enable a new drop-down choice, `1`, in the `priority` form field.

    var shortDescription = g_form.getValue('shortDescription');

    // Allow priority 1 selection if short description mentions security 
    if (shortDescription.includes('security')) {
    	var p1Choice = g_form.getChoice('priority', '1');
    	g_form.enableChoice('priority', '1');
    }

## GlideForm (Next Experience) - flash(String fieldName, String color, Number count) {#ariaid-title25}

Use to draw attention to a field. Flashes the specified color for a specified duration of time in the specified field.
This method is not supported by Service Catalog.

This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-flash_S_S_N__table_htn_w2w_ts__entry__3}{#GFNX-flash_S_S_N__g_form-flash-fieldName-entry}{#GFNX-flash_S_S_N__g_form-flash-color-entry}{#GFNX-flash_S_S_N__g_form-flash-count-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field to highlight in the following format: `"<table-name>.<field-name>"`. |
| color | String | RGB color or acceptable CSS color. |
| count | Number | How long the label will flash. Valid values: * 2: Flashes for 1 second * 0: Flashes for 2 seconds * -2: Flashes for 3 seconds * -4: Flashes for 4 seconds {#GFNX-flash_S_S_N__ul_idd_sqg_5fc} |
[Table 47. Parameters]

{#GFNX-flash_S_S_N__table_htn_w2w_ts} {#GFNX-flash_S_S_N__table_itn_w2w_ts__entry__2}

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

{#GFNX-flash_S_S_N__table_itn_w2w_ts}  

    g_form.flash("incident.number", "#FFFACD", 0);

## GlideForm (Next Experience) - getActionName() {#ariaid-title26}

Returns the most recent action name, or, for a client script, the sys_id of the UI action clicked.
Note:  
Not available in Wizard client scripts.
{#GFNX-getActionName__table_zhn_xjd_5s__entry__3}

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

{#GFNX-getActionName__table_zhn_xjd_5s} {#GFNX-getActionName__table_a3n_xjd_5s__entry__2}

| Type | Description |
|-|-|
| String | Current action name or sys_id of the UI action clicked. |
[Table 50. Returns]

{#GFNX-getActionName__table_a3n_xjd_5s}  

    function onSubmit() {
       var action = g_form.getActionName();
       alert('You pressed ' + action);
    }

## GlideForm (Next Experience) - getAnnotations() {#ariaid-title27}

Returns a list of all annotations on a form.
[Annotations](https://www.servicenow.com/docs/access?context=configure-form-layout&version=zurich&pubname=zurich-platform-administration&section=t_AddAFormAnnotation&ft:locale=en-US) are visual separators between form elements, or blocks of colored text used to highlight form elements. Use [GlideForm (Next Experience) - getAnnotationByName(String name)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-getAnnotationByName_S "Returns a form annotation of a given name.") to return a specific annotation by its name.
{#GFNX-getAnnotations__table_hrm_qnl_rfc__entry__3}

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

{#GFNX-getAnnotations__table_hrm_qnl_rfc} {#GFNX-getAnnotations__table_irm_qnl_rfc__entry__2}

| Property | Description |
|-|-|
| Array of Objects | Content of the annotation. Data type: Array of Objects [{content: "String", name: "String", visible: Boolean}] |
| array.content | Text of the returned annotation. Data type: String |
| array.name | Name of the returned annotation. Data type: String Table location: Form Annotations \[sys_ui_annotation\], Field: name |
| array.visible | Flag that indicates whether the annotation is visible on the form. Valid values: * true: The annotation is visible. * false: The annotation isn't visible. {#GFNX-getAnnotations__ul_z2j_4tl_rfc} Data type: Boolean |
[Table 52. Returns]

{#GFNX-getAnnotations__table_irm_qnl_rfc}  
The following example first calls getAnnotations() to return all annotations in a form, and then calls hideAnnotation() to hide all annotations in the form.

    const annotations = getAnnotations();

    /* returns:  
    [ 
        { 
            "name": "test-annotation-msg-1", 
            "visible": true, 
            "content": "Test<input id=\"make_spacing_ok\" style=\"visibility:hidden; width:0px;\">" 
        }, 
        { 
            "name": "test-annotation-msg-2", 
            "visible": true, 
            "content": "Test 2<input id=\"make_spacing_ok\" style=\"visibility:hidden; width:0px;\">" 
        } 

    ]*/
    annotations.forEach(function(annotation) {
    	g_form.hideAnnotation(annotation.name);
    });

    // this script hides all annotations on the form. 

## GlideForm (Next Experience) - getAnnotationByName(String name) {#ariaid-title28}

Returns a form annotation of a given name.
[Annotations](https://www.servicenow.com/docs/access?context=configure-form-layout&version=zurich&pubname=zurich-platform-administration&section=t_AddAFormAnnotation&ft:locale=en-US) are visual separators between form elements, or blocks of colored text used to highlight form elements. Use [GlideForm (Next Experience) - getAnnotations()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-getAnnotations "Returns a list of all annotations on a form.") to return all annotations in a form.
{#GFNX-getAnnotationByName_S__table_skr_c4l_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | The name of the annotation to return. Table: Form Annotations \[sys_ui_annotation\], Field: Name |
[Table 53. Parameters]

{#GFNX-getAnnotationByName_S__table_skr_c4l_rfc} {#GFNX-getAnnotationByName_S__table_irm_qnl_rfc__entry__2}

| Property | Description |
|-|-|
| Array of Objects | Content of the annotation. Data type: Array of Objects [{content: "String", name: "String", visible: Boolean}] |
| array.content | Text of the returned annotation. Data type: String |
| array.name | Name of the returned annotation. Data type: String Table location: Form Annotations \[sys_ui_annotation\], Field: name |
| array.visible | Flag that indicates whether the annotation is visible on the form. Valid values: * true: The annotation is visible. * false: The annotation isn't visible. {#GFNX-getAnnotationByName_S__ul_z2j_4tl_rfc} Data type: Boolean |
[Table 54. Returns]

{#GFNX-getAnnotationByName_S__table_irm_qnl_rfc}  
The following example demonstrates how to use the getAnnotationByName() method to retrieve a form annotation according to its given name, test-annotation-msg-1.

       var sampleAnnotation = g_form.getAnnotationByName("test-annotation-msg-1");

       /* returns:  
       { 
           "name": "test-annotation-msg-1", 
           "visible": true, 
           "content": "Test<input id=\"make_spacing_ok\" style=\"visibility:hidden; width:0px;\">" 
       }
       */

## GlideForm (Next Experience) - getBooleanValue(String fieldName) {#ariaid-title29}

Returns a Boolean value for the specified field.
{#GFNX-getBooleanValue_S__table_vfk_25b_5s__entry__3}{#GFNX-getBooleanValue_S__g_form-getBooleanValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field to highlight in the following format: `"<table-name>.<field-name>"`. |
[Table 55. Parameters]

{#GFNX-getBooleanValue_S__table_vfk_25b_5s} {#GFNX-getBooleanValue_S__table_wfk_25b_5s__entry__2}

| Type | Description |
|-|-|
| Boolean | Returns false if the field value is false or undefined; otherwise returns true. |
[Table 56. Returns]

{#GFNX-getBooleanValue_S__table_wfk_25b_5s}

## GlideForm (Next Experience) - getChoice(String fieldName, String choiceValue) {#ariaid-title30}

Returns an object with properties representing a given field and choice value.
{#GFNX-getChoice_S_S__table_evm_xbs_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name of the choice to retrieve. |
| choiceValue | String | Value of the choice to retrieve. |
[Table 57. Parameters]

{#GFNX-getChoice_S_S__table_evm_xbs_rfc} {#GFNX-getChoice_S_S__table_fvm_xbs_rfc__entry__2}

| Property | Description |
|-|-|
| GlideFormChoice object or null | GlideFormChoice object for the specified field and choice value. Returns null if no matching choice exists. Data type: Object ("label", "value", "disabled", "index") |
| GlideFormChoice.label | Read-only display text of the choice. Data type: String |
| GlideFormChoice.value | Read-only value of the choice. Data type: String |
| GlideFormChoice.disabled | Flag that indicates whether the choice is disabled in the form. Valid values: * true: Choice is disabled * false: Choice is enabled. {#GFNX-getChoice_S_S__ul_xzv_rbz_tfc} Data type: Boolean |
| GlideFormChoice.index | Indicates the position of the choice in the drop-down. Data type: Number |
[Table 58. Returns]

{#GFNX-getChoice_S_S__table_fvm_xbs_rfc}  
The following example demonstrates how to call g_form.getChoice() to return information about the `priority` field choices.

    var priority = g_form.getValue('priority'); 

    var priorityLabel = g_form.getChoice('priority', priority).label;

## GlideForm (Next Experience) - getControl(String fieldName) {#ariaid-title31}

Returns the HTML element for the specified field.
Compound fields may contain several HTML elements. This method is generally not necessary as there are built-in methods that use the fields on a form.

If the field is a reference field and the control is a choice list, getControl() may not return a control as expected. In this case, use `sys_select.<table name>.<field name>`.

This method is not available in mobile scripts or Service Portal scripts.
{#GFNX-getControl_S__table_lzt_x5b_5s__entry__3}{#GFNX-getControl_S__g_form-getControl-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field for which to return the HTML element. |
[Table 59. Parameters]

{#GFNX-getControl_S__table_lzt_x5b_5s} {#GFNX-getControl_S__table_mzt_x5b_5s__entry__2}{#GFNX-getControl_S__g_form-getControl-returns-HTMLElement-entry}

| Type | Description |
|-|-|
| HTMLElement | Field's HTML element. |
[Table 60. Returns]

{#GFNX-getControl_S__table_mzt_x5b_5s}

## GlideForm (Next Experience) - getDecimalValue(String fieldName) {#ariaid-title32}

Returns the decimal value of the specified field.
{#GFNX-getDecimalValue_S__table_izt_31c_5s__entry__3}{#GFNX-getDecimalValue_S__g_form-getDecimalValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field for which to return the decimal value. |
[Table 61. Parameters]

{#GFNX-getDecimalValue_S__table_izt_31c_5s} {#GFNX-getDecimalValue_S__table_jzt_31c_5s__entry__2}

| Type | Description |
|-|-|
| String | Decimal value of the specified field. |
[Table 62. Returns]

{#GFNX-getDecimalValue_S__table_jzt_31c_5s}  

    function onChange(control, oldValue, newValue, isLoading) {
       alert(g_form.getDecimalValue('percent_complete'));
    }

## GlideForm (Next Experience) - getDisplayValue(String fieldName) {#ariaid-title33}

Returns the display value from a form in Service Portal.
See also:

* [getValue()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-getValue_S "Returns the value of the specified form field.")
* [Get the display value of a reference variable](https://www.servicenow.com/community/developer-blog/get-display-value-of-reference-variable-service-catalog/ba-p/2287763)
{#GFNX-getDisplayValue_S__ul_djx_h4g_cvb}  
Note:  
In the core UI, calling this method as `g_form.getDisplayValue()` without an argument returns the record display value rather than the display value of an individual field.
{#GFNX-getDisplayValue_S__table_nf2_bfp_zw__entry__3}{#GFNX-getDisplayValue_S__g_form-getDisplayValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field from which you want to retrieve a value in the form. |
[Table 63. Parameters]

{#GFNX-getDisplayValue_S__table_nf2_bfp_zw} {#GFNX-getDisplayValue_S__table_ydf_qpc_5s__entry__2}

| Type | Description |
|-|-|
| String | Display value of the specified field. |
[Table 64. Returns]

{#GFNX-getDisplayValue_S__table_ydf_qpc_5s}  
The following example shows how to get the display value of a reference variable in the core UI or Service Portal. The use case for this example is on the [community](https://www.servicenow.com/community/developer-blog/get-display-value-of-reference-variable-service-catalog/ba-p/2287763) site.

    function onChange(control, oldValue, newValue, isLoading) {
         if (isLoading || newValue == '') {
              return;
         }
         if(window == null){
              var valuePortal = g_form.getDisplayValue('requester');
              alert('Portal->' + valuePortal);
         }
         else{
              var valueNative = g_form.getDisplayBox('requester').value;     
              alert('CoreUI->' + valueCoreUI);
         }
         //Type appropriate comment here, and begin script below
    }

## GlideForm (Next Experience) - getElement(String id) {#ariaid-title34}

Returns the HTML element specified by the parameter.
Compound fields may contain several HTML elements. This method is generally not necessary as there are built-in methods that use the fields on a form.

This method is not available in mobile scripts or Service Portal scripts.
{#GFNX-getElement_S__table_l1k_vvb_5s__entry__3}{#GFNX-getElement_S__g_form-getElement-id-entry}

| Name | Type | Description |
|-|-|-|
| id | String | Field ID. |
[Table 65. Parameters]

{#GFNX-getElement_S__table_l1k_vvb_5s} {#GFNX-getElement_S__table_m1k_vvb_5s__entry__2}{#GFNX-getElement_S__g_form-getElement-returns-HTMLElement-entry}

| Type | Description |
|-|-|
| HTMLElement | Field's HTML element. |
[Table 66. Returns]

{#GFNX-getElement_S__table_m1k_vvb_5s}

## GlideForm (Next Experience) - getFormElement() {#ariaid-title35}

Returns the HTML element for the form.
This method is not available in mobile scripts or Service Portal scripts.
{#GFNX-getFormElement__table_fs4_kkd_5s__entry__3}

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

{#GFNX-getFormElement__table_fs4_kkd_5s} {#GFNX-getFormElement__table_gs4_kkd_5s__entry__2}{#GFNX-getFormElement__g_form-getFormElement-returns-HTMLElement-entry}

| Type | Description |
|-|-|
| HTMLFormElement | HTML element for the form. |
[Table 68. Returns]

{#GFNX-getFormElement__table_gs4_kkd_5s}

## GlideForm (Next Experience) - getIntValue(String fieldName) {#ariaid-title36}

Returns the integer value for the specified field.
{#GFNX-getIntValue_S__table_unc_nwb_5s__entry__3}{#GFNX-getIntValue_S__g_form-getIntValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name. |
[Table 69. Parameters]

{#GFNX-getIntValue_S__table_unc_nwb_5s} {#GFNX-getIntValue_S__table_vnc_nwb_5s__entry__2}{#GFNX-getIntValue_S__g_form-getIntValue-returns-entry}

| Type | Description |
|-|-|
| Number | Integer value of the field. |
[Table 70. Returns]

{#GFNX-getIntValue_S__table_vnc_nwb_5s}

## GlideForm (Next Experience) - getLabelOf(String fieldName) {#ariaid-title37}

Returns the plain text value of the field label.
{#GFNX-getLabelOf_S__table_gfz_kgw_ts__entry__3}{#GFNX-getLabelOf_S__g_form-getLabelOf-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name. |
[Table 71. Parameters]

{#GFNX-getLabelOf_S__table_gfz_kgw_ts} {#GFNX-getLabelOf_S__table_hfz_kgw_ts__entry__2}{#GFNX-getLabelOf_S__g_form-getLabelOf-returns-entry}

| Type | Description |
|-|-|
| String | Label text. |
[Table 72. Returns]

{#GFNX-getLabelOf_S__table_hfz_kgw_ts}  

    if (g_user.hasRole('itil')) {
        var oldLabel = g_form.getLabelOf('comments');
        g_form.setLabelOf('comments', oldLabel + ' (Customer visible)');
    }

## GlideForm (Next Experience) - getOptions(String fieldName) {#ariaid-title38}

Returns the available and selected options for a choice or reference field on the form. This method is useful for dynamic forms, catalog variables and variable sets, and integrations needing to inspect or filter field options at runtime.
For example, you can use the g_form.getOptions() to:  
* Get and set the name-value pairs in a watch_list field type.
* Search or filter available options by a search term.
* Enable access to the same auto-complete results via a callback.
* Get and set options on choice fields, reference fields, and advanced field types such as watch_list, glide_list, field_list, and slushbucket.
{#GFNX-getOptions_S__ul_rgd_24f_wfc}
{#GFNX-getOptions_S__table_dz3_jyr_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| fieldName | String | The field name of the choice or reference field to retrieve. |
[Table 73. Parameters]

{#GFNX-getOptions_S__table_dz3_jyr_rfc} {#GFNX-getOptions_S__table_ez3_jyr_rfc__entry__2}

| Property | Description |
|-|-|
| Array of Objects or null | Read-only array of objects containing the value and label of each selected option. Returns null if the field does not support options. Data type: Array of Objects [{value: "String", displayValue: "String"}] |
| array.displayValue | The choice display value. Data type: String |
| array.value | The value of the option. Data type: String |
| getAvailable(term) | Function for returning all available options. A search term can be provided as an argument to filter the options by display value (a case-insensitive sub string match). Returns a Promise of Array of Objects with the matching choice's display value and value. Data type: Array of Objects [{value: "String", displayValue: "String"}] |
[Table 74. Returns]

{#GFNX-getOptions_S__table_ez3_jyr_rfc}  
The following example calls g_form.getOptions() to return all available choices for specified form fields, like state, work_notes_list, and others.

    g_form.getOptions("state"); //table: incident, field: state, type: integer, choice: Dropdown without --None--
    /*
    returns [{"value":"1","displayValue":"New"},{"value":"2","displayValue":"In Progress"},{"value":"3","displayValue":"On Hold"},{"value":"6","displayValue":"Resolved"},{"value":"7","displayValue":"Closed"},{"value":"8","displayValue":"Canceled"}]
    */

    g_form.getOptions("category"); //table: incident, field: category, type: string, choice: Dropdown with --None--
    /*
    returns [{"value":"","displayValue":"-- None --"},{"value":"inquiry","displayValue":"Inquiry / Help"},{"value":"software","displayValue":"Software"},{"value":"hardware","displayValue":"Hardware"},{"value":"network","displayValue":"Network"},{"value":"database","displayValue":"Database"}]
    */

    g_form.getOptions("work_notes_list") //table: incident, field: work_notes_list, type: glide_list
    /*
    returns [{"value":"62826bf03710200044e0bfc8bcbe5df1","displayValue":"Abel Tuter"},{"value":"a8f98bb0eb32010045e1a5115206fe3a","displayValue":"Abraham Lincoln"},{"value":"5137153cc611227c000bbd1bd8cd2005","displayValue":"Fred Luddy"},{"value":"6a826bf03710200044e0bfc8bcbe5dec","displayValue":"Alissa Mountjoy"}]
    */

    g_form.getOptions("restricted_fields") //table: std_change_properties, field: restricted_fields, type: field_list
    /*
    [{"value":"activity_due","displayValue":"Activity due"},{"value":"additional_assignee_list","displayValue":"Additional assignee list"},{"value":"comments","displayValue":"Additional comments"},{"value":"assignment_group","displayValue":"Assignment group"},{"value":"backout_plan","displayValue":"Backout plan"},{"value":"business_duration","displayValue":"Business duration"},{"value":"cab_delegate","displayValue":"CAB delegate"},...]
    */

    g_form.getOptions('table') //table: sys_script_client, field: table, type: table_name
    /*
    [{"value":"","displayValue":"-- None --"},{"value":"cmdb_ci_appl_dot_net","displayValue":".NET Application [cmdb_ci_appl_dot_net]"},{"value":"evaluation","displayValue":"A/B Testing Evaluation [evaluation]"},{"value":"evaluation_execution","displayValue":"A/B Testing Evaluation Execution [evaluation_execution]"},{"value":"evaluation_parameter","displayValue":"A/B Testing Evaluation Parameter [evaluation_parameter]"},{"value":"sn_access_analyzer_request","displayValue":"Access Analyzer Query [sn_access_analyzer_request]"},{"value":"sn_access_analyzer_access_comparison_request","displayValue":"Access Comparison Request [sn_access_analyzer_access_comparison_request]"},{"value":"sys_security_acl","displayValue":"Access Control [sys_security_acl]"},...]
    */

    g_form.getOptions('mandatory_fields'); //table: kb_knowledge_base, field: mandatory_fields, type: slushbucket
    /*
    [{"value":"active","displayValue":"Active"},{"value":"article_id","displayValue":"Article ID"},{"value":"displayValue","displayValue":"Article body"},{"value":"article_type","displayValue":"Article type"},{"value":"direct","displayValue":"Attachment link"},{"value":"author","displayValue":"Author"},{"value":"base_version","displayValue":"Base Version"},...]
    */

The following example script demonstrates how to call g_form.getOptions() with getAvailable() function.

    const options = g_form.getOptions('priority');
    if (options) {
      console.log('Selected:', options.selected);
      options.getAvailable('high').then(available => {
        console.log('Available matching "high":', available);
      });
    }

## GlideForm (Next Experience) - getReference(String fieldName, Function callBack) {#ariaid-title39}

Returns the GlideRecord for a specified field.
If a callback function is present, this routine runs asynchronously. The browser (and script) processing continues normally until the server returns the reference value, at which time, the callback function is invoked. If a
callback function is not present, this routine runs synchronously and processing halts (causing the browser to appear to hang) while waiting on a server response.  
Important:  
It is strongly recommended that you use a callback function.

Callback function support for ServiceCatalogForm.getReference is available.  
Note:  
Using this method requires a call to the server which requires additional time and may introduce latency to your page. Use this method with caution. For additional information, see [Client script design and processing](https://www.servicenow.com/docs/22KM21kAwOt5hQtfBHhd9Q#client-script-best-practices "Well-designed client scripts can reduce the amount of time it takes users to complete a form.").
{#GFNX-getReference_S_F__table_k4c_1yb_5s__entry__3}{#GFNX-getReference_S_F__g_form-getReference-fieldName-entry}{#GFNX-getReference_S_F__g_form-getReference-callBack-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field. |
| callBack | Function | Name of the call back function. |
[Table 75. Parameters]

{#GFNX-getReference_S_F__table_k4c_1yb_5s} {#GFNX-getReference_S_F__table_l4c_1yb_5s__entry__2}{#GFNX-getReference_S_F__g_form-getReference-returns-entry}

| Type | Description |
|-|-|
| GlideRecord | GlideRecord object for the specified field. If the specified reference can't be found, it returns an initialized GlideRecord object where `currentRow = -1` and `rows.length = 0`. |
[Table 76. Returns]

{#GFNX-getReference_S_F__table_l4c_1yb_5s}  

    function onChange(control, oldValue, newValue, isLoading) {
        g_form.getReference('caller_id', doAlert); // doAlert is our callback function
    }
     
    function doAlert(caller) { // reference is passed into callback as first arguments
       if (caller.getValue('vip') == 'true') {
          alert('Caller is a VIP!');
       }
    }

## GlideForm (Next Experience) - getRelatedListNames() {#ariaid-title40}

Returns an array of related list names from the current form.
{#GFNX-getRelatedListNames__table_vfp_grv_dhb__entry__3}

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

{#GFNX-getRelatedListNames__table_vfp_grv_dhb} {#GFNX-getRelatedListNames__table_wfp_grv_dhb__entry__2}{#GFNX-getRelatedListNames__g_form-getRelatedListNames-returns-entry}

| Type | Description |
|-|-|
| Array of Strings | List of related list names from the current form. The related list names are listed in the order in which they appear on the form. |
[Table 78. Returns]

{#GFNX-getRelatedListNames__table_wfp_grv_dhb}  

    var listNames = g_form.getRelatedListNames();

    for (var i = 0; i < listNames.length; i++) {  
      this.showRelatedList(listNames[i]);
     }

## GlideForm (Next Experience) - getSectionNames() {#ariaid-title41}

Returns all section names, whether visible or not.
{#GFNX-getSectionNames__table_rsg_vkd_5s__entry__3}

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

{#GFNX-getSectionNames__table_rsg_vkd_5s} {#GFNX-getSectionNames__table_ssg_vkd_5s__entry__2}{#GFNX-getSectionNames__g_form-getSectionNames-returns-entry}

| Type | Description |
|-|-|
| Array of Strings | Section names. |
[Table 80. Returns]

{#GFNX-getSectionNames__table_ssg_vkd_5s}

## GlideForm (Next Experience) - getSections() {#ariaid-title42}

Returns an array of the form's sections.
This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-getSections__table_sg4_hld_5s__entry__3}

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

{#GFNX-getSections__table_sg4_hld_5s} {#GFNX-getSections__table_tg4_hld_5s__entry__2}{#GFNX-getSections__g_form-getSections-returns-entry}

| Type | Description |
|-|-|
| Array of HTML elements | Form's sections. |
[Table 82. Returns]

{#GFNX-getSections__table_tg4_hld_5s}  

    function onChange(control, oldValue, newValue, isLoading) {
       //this example was run on a form divided into sections (Change form)
       // and hid a section when the "state" field was changed
       var sections = g_form.getSections();
       if (newValue == '2') {
          g_form.setSectionDisplay(sections[1], false);
       } else {
          g_form.setSectionDisplay(sections[1], true);
       }
    }

## GlideForm (Next Experience) - getTableName() {#ariaid-title43}

Returns the name of the table to which this record belongs.
On the server side, the table for the current record can be retrieved with current.sys_class_name or current.getTableName().
{#GFNX-getTableName__table_gqk_5ld_5s__entry__3}

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

{#GFNX-getTableName__table_gqk_5ld_5s} {#GFNX-getTableName__table_hqk_5ld_5s__entry__2}{#GFNX-getTableName__g_form-getTableName-returns-entry}

| Type | Description |
|-|-|
| String | Name of the table. |
[Table 84. Returns]

{#GFNX-getTableName__table_hqk_5ld_5s}  

    function onLoad() {
        if (g_form.isNewRecord()) {
            var tableName = g_form.getTableName(); //Get the table name
        }
    }

## GlideForm (Next Experience) - getUniqueValue() {#ariaid-title44}

Returns the sys_id of the record displayed in the form.
{#GFNX-getUniqueValue__table_xxg_lmd_5s__entry__3}

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

{#GFNX-getUniqueValue__table_xxg_lmd_5s} {#GFNX-getUniqueValue__table_yxg_lmd_5s__entry__2}{#GFNX-getUniqueValue__g_form-getUniqueValue-returns-entry}

| Type | Description |
|-|-|
| String | Record's sys_id. |
[Table 86. Returns]

{#GFNX-getUniqueValue__table_yxg_lmd_5s}  

    function onLoad() {
       var incSysid = g_form.getUniqueValue();
       alert(incSysid);
    }

## GlideForm (Next Experience) - getValue(String fieldName) {#ariaid-title45}

Returns the value of the specified form field.
This method also supports getting values from a multi-row variable set (MRVS). To obtain data from fields within an MRVS, you must first use `JSON.parse(getValue('<mrvs_field_name>') || '[]')` to obtain the
MRVS array, and then use indexing to access the fields within the row objects. For more details, see the code example below.
{#GFNX-getValue_S__table_nxm_wzb_5s__entry__3}{#GFNX-getValue_S__g_form-getValue-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field whose value to return. |
[Table 87. Parameters]

{#GFNX-getValue_S__table_nxm_wzb_5s} {#GFNX-getValue_S__table_oxm_wzb_5s__entry__2}{#GFNX-getValue_S__g_form-getValue-returns-entry}

| Type | Description |
|-|-|
| String | Value of the specified field. |
[Table 88. Returns]

{#GFNX-getValue_S__table_oxm_wzb_5s}  
The following example shows how to get the short description from the current form.

    function onChange(control, oldValue, newValue, isLoading) {
       alert(g_form.getValue('short_description'));
    }

The following example shows how to get values from an MRVS. In this example, salaries are being managed through the Service Catalog. The client script searches all rows within the MRVS for the value entered in the Job title and then updates the matching entries within the MRVS with what is entered in the Salary field. The MRVS is named "variable_set_1" and contains the following fields within each row
object: Employee name \[employee_name\], Job title \[employee_job_title\], and Salary \[employee_salary\]. In addition, the Catalog Item contains: Job title \[job_title\] and Salary \[salary\].

    function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
    return;
    }
     
    // Get the MRVS
    var vs1 = g_form.getValue('variable_set_1') || '[]';
    var multiRowVariableSet = JSON.parse(vs1);
     
    for (var i = 0; i < multiRowVariableSet.length; i++) {
    // Check if the entered job title matches the title in the current MRVS row
      if (multiRowVariableSet[i].employee_job_title == g_form.getValue("job_title")){
        // Update the value of a matching field with the new salary
        multiRowVariableSet[i].employee_salary = newValue;
      }
    }
     
    // Update the MRVS
    g_form.setValue('variable_set_1', JSON.stringify(multiRowVariableSet));
    }

## GlideForm (Next Experience) - hideAllFieldMsgs() {#ariaid-title46}

Hides all field messages.
{#GFNX-hideAllFieldMsgs__table_mr1_3hw_ts__entry__3}

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

{#GFNX-hideAllFieldMsgs__table_mr1_3hw_ts} {#GFNX-hideAllFieldMsgs__table_nr1_3hw_ts__entry__2}

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

{#GFNX-hideAllFieldMsgs__table_nr1_3hw_ts}

## GlideForm (Next Experience) - hideAllFieldMsgs(String type) {#ariaid-title47}

Hides all field messages of the specified type.
{#GFNX-hideAllFieldMsgs_S__table_y2c_qhw_ts__entry__3}{#GFNX-hideAllFieldMsgs_S__g_form-hideAllFieldMsgs_S-type-entry}

| Name | Type | Description |
|-|-|-|
| type | String | \>Type of message. Valid values: * error * info {#GFNX-hideAllFieldMsgs_S__ul_rgd_sqg_5fc} |
[Table 91. Parameters]

{#GFNX-hideAllFieldMsgs_S__table_y2c_qhw_ts} {#GFNX-hideAllFieldMsgs_S__table_z2c_qhw_ts__entry__2}

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

{#GFNX-hideAllFieldMsgs_S__table_z2c_qhw_ts}

## GlideForm (Next Experience) - hideAnnotation(String name) {#ariaid-title48}

Hides an annotation with a given name on the form UI.
[Annotations](https://www.servicenow.com/docs/access?context=configure-form-layout&version=zurich&pubname=zurich-platform-administration&section=t_AddAFormAnnotation&ft:locale=en-US) are visual separators between form elements, or blocks of colored text used to highlight form elements. See also:

* [GlideForm (Next Experience) - showAnnotation(String name)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-showAnnotation_S "Shows an annotation with a given name on the form UI.") to display a specific annotation on the form.
* [GlideForm (Next Experience) - toggleAnnotations()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-toggleAnnotations "Hides or shows all annotations on the form.") to toggle annotations on and off with greater flexibility.
{#GFNX-hideAnnotation_S__ul_iqn_jmf_wfc}
{#GFNX-hideAnnotation_S__table_isv_1nt_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the annotation to hide in the form. Table: Form Annotations \[sys_ui_annotation\], Field: Name |
[Table 93. Parameters]

{#GFNX-hideAnnotation_S__table_isv_1nt_rfc} {#GFNX-hideAnnotation_S__table_ovh_cnt_rfc__entry__2}

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

{#GFNX-hideAnnotation_S__table_ovh_cnt_rfc}  
The following example demonstrates how to programmatically hide the annotation named test-annotation-msg-1 on the form field using the hideAnnotation() method.

    g_form.hideAnnotation('test-annotation-msg-1');

## GlideForm (Next Experience) - hideErrorBox(String fieldName) {#ariaid-title49}

Hides the error message placed by showErrorBox().
Whenever possible, use hideFieldMsg() rather than this method whenever possible.
{#GFNX-hideErrorBox_S__table_kll_t4w_ts__entry__3}{#GFNX-hideErrorBox_S__g_form-hideErrorBox-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field or control whose error message to hide. |
[Table 95. Parameters]

{#GFNX-hideErrorBox_S__table_kll_t4w_ts} {#GFNX-hideErrorBox_S__table_lll_t4w_ts__entry__2}

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

{#GFNX-hideErrorBox_S__table_lll_t4w_ts}

## GlideForm (Next Experience) - hideFieldMsg(String fieldName, Boolean clearAll) {#ariaid-title50}

Hides the first message that appears in the specified field on the current form.
Use the [showFieldMsg(String field, String message, String type)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-showFieldMsg_S_S_S "Displays a message under the specified form field (either a control object or the name of the field). If the control or field is off the screen, the method automatically scrolls the form to that field.") or [showFieldMsg(String field, String message, String type, Boolean scrollForm)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-showFieldMsg_S_S_S_B "Displays a message under the specified form field (either a control object or the name of the field). If the control or field is currently off the screen and scrollForm is true, the method scrolls the form to that field.") methods to display messages on a form.  
For example, the following code snippet shows how to display two messages on the `work_notes` field of a form and then hide the first message:

    g_form.showFieldMsg('work_notes', 'First message', "error");
    g_form.showFieldMsg('work_notes', 'Second message', "error");
    g_form.hideFieldMsg('work_notes', false); // This call hides the 'First message'

{#GFNX-hideFieldMsg_S__table_xnf_3pw_ts__entry__3}{#GFNX-hideFieldMsg_S__g_form-hideFieldMsg-fieldName-entry}{#GFNX-hideFieldMsg_S__g_form-hideFieldMsg-clearAll-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field on which to hide the message. |
| clearAll | Boolean | Optional. Flag that indicates whether to hide all messages for the specified field. Valid values: * true: Hide all messages. * false: Only hide the first message being displayed. {#GFNX-hideFieldMsg_S__ul_add_sqg_5fc} Default: false |
[Table 97. Parameters]

{#GFNX-hideFieldMsg_S__table_xnf_3pw_ts} {#GFNX-hideFieldMsg_S__table_ynf_3pw_ts__entry__2}

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

{#GFNX-hideFieldMsg_S__table_ynf_3pw_ts}  
The following example shows how to clear all messages for a specified form field and then display an encryption error message.

    function submitEncryptedInputs() {
      return processEncryptedInputs(function(inputName, fieldName) {
        if (!checkEncryptedFieldValue(fieldName)) {
          g_form.hideFieldMsg(fieldName, true); // Hide all messages for the specified field
          g_form.showFieldMsg(fieldName, "Your activity requires an encrypted input.", "error");
          return false;
        }
        return true;
      });
    }

## GlideForm (Next Experience) - hideRelatedList(String listTableName) {#ariaid-title51}

Hides the specified related list on the form.
This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-hideRelatedList_S__table_syn_wqw_ts__entry__3}{#GFNX-hideRelatedList_S__g_form-hideRelatedList-listTableName-entry}

| Name | Type | Description |
|-|-|-|
| listTableName | String | Name of the related list. Use the sys_id to hide a list through a relationship. |
[Table 99. Parameters]

{#GFNX-hideRelatedList_S__table_syn_wqw_ts} {#GFNX-hideRelatedList_S__table_tyn_wqw_ts__entry__2}

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

{#GFNX-hideRelatedList_S__table_tyn_wqw_ts}

## GlideForm (Next Experience) - hideRelatedLists() {#ariaid-title52}

Hides all related lists on the form.
This method is not available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-hideRelatedLists__table_zmg_jrw_ts__entry__3}

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

{#GFNX-hideRelatedLists__table_zmg_jrw_ts} {#GFNX-hideRelatedLists__table_ang_jrw_ts__entry__2}

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

{#GFNX-hideRelatedLists__table_ang_jrw_ts}

## GlideForm (Next Experience) - isMandatory(String fieldName) {#ariaid-title53}

Returns true if the field is mandatory.
Mandatory fields are visually distinguished by an asterisk next to the field label. The asterisk is red if the field is empty, and black if the field is not empty. The system displays a
validation message if a user attempts to save or submit the form without completing those fields. For more information, see [Form fields](https://www.servicenow.com/docs/access?context=c_FormFields&version=zurich&pubname=zurich-platform-user-interface&ft:locale=en-US).
{#GFNX-isMandatory_S__table_kpt_nnc_5s__entry__3}{#GFNX-isMandatory_S__g_form-isMandatory-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field. |
[Table 103. Parameters]

{#GFNX-isMandatory_S__table_kpt_nnc_5s} {#GFNX-isMandatory_S__table_lpt_nnc_5s__entry__2}{#GFNX-isMandatory_S__g_form-isMandatory-returns-entry}

| Type | Description |
|-|-|
| Boolean | True if the field is required, false otherwise. |
[Table 104. Returns]

{#GFNX-isMandatory_S__table_lpt_nnc_5s}

## GlideForm (Next Experience) - isNewRecord() {#ariaid-title54}

Returns true if the record has never been saved.
{#GFNX-isNewRecord__table_wlm_wmd_5s__entry__3}

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

{#GFNX-isNewRecord__table_wlm_wmd_5s} {#GFNX-isNewRecord__table_xlm_wmd_5s__entry__2}{#GFNX-isNewRecord__g_form-isNewRecord-returns-entry}

| Type | Description |
|-|-|
| Boolean | Returns true if the record has not been saved; otherwise false. |
[Table 106. Returns]

{#GFNX-isNewRecord__table_xlm_wmd_5s}  

    function onLoad() {
       if(g_form.isNewRecord()){
          alert('New Record!');
       }
    }

## GlideForm (Next Experience) - isVisible(String fieldName) {#ariaid-title55}

Determines whether the field associated with the passed-in field name is visible on the current form.
{#GFNX-isVisible_S__table_ps3_gqy_m2c__entry__3}{#GFNX-isVisible_S__g_form-isVisible-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field to check whether it is visible on the current form. |
[Table 107. Parameters]

{#GFNX-isVisible_S__table_ps3_gqy_m2c} {#GFNX-isVisible_S__table_qs3_gqy_m2c__entry__2}{#GFNX-isVisible_S__g_form-isVisible-returns-entry}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the specified field is visible on the current form. Possible values: * true: Field is visible on the form. * false: Field isn't visible on the form. {#GFNX-isVisible_S__ul_p1v_dhp_jfc} |
[Table 108. Returns]

{#GFNX-isVisible_S__table_qs3_gqy_m2c}  
The following code example shows how to check if the `user_address` field is visible on the current form.

    if(g_form.isVisible('user_address')) {
        alert('is visible');
    }
    else {
        alert('is hidden');
    }

## GlideForm (Next Experience) - onUserChangeValue(Function fn) {#ariaid-title56}

Registers a custom event listener that detects when any field in the current form is modified by a user.
When a form field is modified, the event listener calls the function that is passed in when the listener is initially registered. This listener is only triggered when a user makes a change to a field on the form. Changes from
client scripts, UI policies, or any other non-user interactions, do not trigger the listener.  
Note:  
This method does not work for journal fields or Service Catalog items in the classic environment.
{#GFNX-onUserChangeValue_F__table_m5y_wll_1hb__entry__3}{#GFNX-onUserChangeValue_F__g_form-onUserChangeValue-fn-entry}

| Name | Type | Description |
|-|-|-|
| fn | Function | Function to call when a user changes the value of a field within the current form. This is actually the function code, not just the function name. This function must accept the following three arguments: * field name * original field value * updated field value {#GFNX-onUserChangeValue_F__ul_k2d_sqg_5fc} |
[Table 109. Parameters]

{#GFNX-onUserChangeValue_F__table_m5y_wll_1hb} {#GFNX-onUserChangeValue_F__table_n5y_wll_1hb__entry__2}{#GFNX-onUserChangeValue_F__g_form-onUserChangeValue-returns-entry}

| Type | Description |
|-|-|
| Function | Function to call to unregister the onUserChangeValue event listener. |
[Table 110. Returns]

{#GFNX-onUserChangeValue_F__table_n5y_wll_1hb}  

    var handler = function(fieldname, originalValue, newValue) {
      console.log('The field ('+ fieldname + ') has a new value of: ' + newValue); // function code
    }
     
    var unregister = g_form.onUserChangeValue(handler);
     
    // To unregister the event listener
    unregister();

## GlideForm (Next Experience) - removeChoice(String fieldName, String choiceValue) {#ariaid-title57}

Removes the specified choice from the specified choice list field.
{#GFNX-removeChoice_S_S__table_jsy_bys_rfc__entry__3}

|   |   |   |
|-|-|-|
| fieldName | String | Name of the filed from which to remove a single choice from the choice list. |
| choiceValue | String | Value of the choice to remove from the choice list. |
[Table 111. Parameters]

{#GFNX-removeChoice_S_S__table_jsy_bys_rfc} {#GFNX-removeChoice_S_S__table_q4k_hjd_5s__entry__2}

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

{#GFNX-removeChoice_S_S__table_q4k_hjd_5s}  

    g_form.removeChoice('priority', '1');

## GlideForm (Next Experience) - removeDecoration(String fieldname, String icon, String title) {#ariaid-title58}

Removes the icon from the specified field that matches the specified icon and title.
Note:  
This method isn't supported by Service Catalog.
{#GFNX-removeDecoration_S_S_S__table_x23_vrw_ts__entry__3}{#GFNX-removeDecoration_S_S_S__g_form-removeDecoration-fieldName-entry}{#GFNX-removeDecoration_S_S_S__g_form-removeDecoration-icon-entry}{#GFNX-removeDecoration_S_S_S__g_form-removeDecoration-title-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name from which to remove the decoration. |
| icon | String | Name of the icon to remove. |
| title | String | Icon's text title (name). |
[Table 113. Parameters]

{#GFNX-removeDecoration_S_S_S__table_x23_vrw_ts} {#GFNX-removeDecoration_S_S_S__table_y23_vrw_ts__entry__2}

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

{#GFNX-removeDecoration_S_S_S__table_y23_vrw_ts}  

    function onChange(control, oldValue, newValue, isLoading) {
    	// if the caller_id field is not present, then we can't add an icon anywhere
    	if (!g_form.hasField('caller_id'))
    		return;
     
    	if (!newValue)
    		return;
     
    	g_form.getReference('caller_id', function(ref) {
    		g_form.removeDecoration('caller_id', 'icon-star', 'VIP');
     
    		if (ref.getValue('vip') == 'true')
    			g_form.addDecoration('caller_id', 'icon-star', 'VIP');			
    	});
    }

## GlideForm (Next Experience) - removeDecoration(String fieldname, String icon, String title, String color) {#ariaid-title59}

Removes the icon from the specified field that matches the specified icon, title, and color.
Note:  
This method isn't supported by Service Catalog.
{#GFNX-removeDecoration_S_S_S_S__table_mcg_5zd_5s__entry__3}{#GFNX-removeDecoration_S_S_S_S__g_form-removeDecoration-fieldName-entry}{#GFNX-removeDecoration_S_S_S_S__g_form-removeDecoration-icon-entry}{#GFNX-removeDecoration_S_S_S_S__g_form-removeDecoration-title-entry}{#GFNX-removeDecoration_S_S_S_S__g_form-removeDecoration-color-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name from which to remove the decoration. |
| icon | String | Name of the icon to remove. |
| title | String | Icon's text title (name). |
| color | String | CSS color to match. |
[Table 115. Parameters]

{#GFNX-removeDecoration_S_S_S_S__table_mcg_5zd_5s} {#GFNX-removeDecoration_S_S_S_S__table_ncg_5zd_5s__entry__2}

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

{#GFNX-removeDecoration_S_S_S_S__table_ncg_5zd_5s}  

    g_form.removeDecoration('caller_id', 'icon-star', 'VIP', 'blue');

## GlideForm (Next Experience) - removeOption(String fieldName, String choiceValue) {#ariaid-title60}

Removes the specified option from the specified choice list.
{#GFNX-removeOption_S_S__table_p4k_hjd_5s__entry__3}{#GFNX-removeOption_S_S__g_form-removeOption-fieldName-entry}{#GFNX-removeOption_S_S__g_form-removeOption-choiceValue-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field from which to remove the option from the choice list. |
| choiceValue | String | Value stored in the database. This is not the label. |
[Table 117. Parameters]

{#GFNX-removeOption_S_S__table_p4k_hjd_5s} {#GFNX-removeOption_S_S__table_q4k_hjd_5s__entry__2}

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

{#GFNX-removeOption_S_S__table_q4k_hjd_5s}  

    g_form.removeOption('priority', '1');

## GlideForm (Next Experience) - save() {#ariaid-title61}

Saves the record without navigating away (update and stay).
{#GFNX-save__table_xgb_3qd_5s__entry__3}

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

{#GFNX-save__table_xgb_3qd_5s} {#GFNX-save__table_ygb_3qd_5s__entry__2}

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

{#GFNX-save__table_ygb_3qd_5s}

## GlideForm (Next Experience) - setChoiceLabel(String fieldName, String choiceValue, String newLabel) {#ariaid-title62}

Updates the label of a specific choice in the drop-down field.
When calling this method, the index position of the updated option in the drop-down remains unchanged. The enabled or disabled state of the option is preserved.
{#GFNX-setChoiceLabel_S_S_S__table_q2s_gds_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Field name that contains the choice to update. Data type: String |
| choiceValue | String | Value of the choice label to update with a new label. Data type: String |
| newLabel | String | Label name to update the existing choice label to. Data type: String |
[Table 121. Parameters]

{#GFNX-setChoiceLabel_S_S_S__table_q2s_gds_rfc} {#GFNX-setChoiceLabel_S_S_S__table_fvm_xbs_rfc__entry__2}

| Type | Description |
|-|-|
| Boolean | Flag that indicates whether the option label is updated successfully. Valid values: * true: Choice label is updated. * false: Choice label isn't updated because the specified choice to update may have been read-only or does not exist, or the new label exists and is already associated with another option. {#GFNX-setChoiceLabel_S_S_S__ul_m4d_pfq_xfc} |
[Table 122. Returns]

{#GFNX-setChoiceLabel_S_S_S__table_fvm_xbs_rfc}  
The following example calls setChoiceLabel() to update the 'bonus' field choices (10, 20, and 30) to new values.

    // Show the calculated bonus next to the percentage label
    var salary = parseInt(g_form.getValue('salary'), 10); 
    g_form.setChoiceLabel('bonus', '10', '10% ($'+ (salary * .10) +')'); 
    g_form.setChoiceLabel('bonus', '20', '20% ($'+ (salary * .20) +')'); 
    g_form.setChoiceLabel('bonus', '30', '30% ($'+ (salary * .30) +')');

## GlideForm (Next Experience) - setDisabled(String fieldName, Boolean disable) {#ariaid-title63}

Makes the specified field available or unavailable.
{#GFNX-setDisabled_S_B__table_sn2_j4c_5s__entry__3}{#GFNX-setDisabled_S_B__g_form-setDisabled-fieldName-entry}{#GFNX-setDisabled_S_B__g_form-setDisabled-disable-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field to enable or disable. |
| disable | Boolean | Flag that indicates whether to disable the specified field. Valid values: * true: Disable the field. * false: Enables the field. {#GFNX-setDisabled_S_B__ul_odn_3hw_jfc} Default: false |
[Table 123. Parameters]

{#GFNX-setDisabled_S_B__table_sn2_j4c_5s} {#GFNX-setDisabled_S_B__table_tn2_j4c_5s__entry__2}

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

{#GFNX-setDisabled_S_B__table_tn2_j4c_5s}

## GlideForm (Next Experience) - setDisplay(String fieldName, Boolean display) {#ariaid-title64}

Displays or hides a specified field on the form.
This method can't hide a mandatory field with no value. If the field is hidden, the space is used to display other items. Whenever possible, use a UI policy instead of this method.
{#GFNX-setDisplay_S_B__table_k4d_ctw_ts__entry__3}{#GFNX-setDisplay_S_B__g_form-setDisplay-fieldName-entry}{#GFNX-setDisplay_S_B__g_form-setDisplay-display-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field. |
| display | Boolean | Flag that indicates whether to display the specified field. Valid values: * true: Display the field. * false: Hide the field. {#GFNX-setDisplay_S_B__ul_vdd_sqg_5fc} |
[Table 125. Parameters]

{#GFNX-setDisplay_S_B__table_k4d_ctw_ts} {#GFNX-setDisplay_S_B__table_l4d_ctw_ts__entry__2}

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

{#GFNX-setDisplay_S_B__table_l4d_ctw_ts}  

    function onChange(control, oldValue, newValue, isLoading, isTemplate) {
       //If the page isn't loading
       if (!isLoading) {
          //If the new value isn't blank
          if (newValue != '') {
             g_form.setDisplay('priority', false);   
          }
          else 
             g_form.setDisplay('priority', true);
          }
       }

## GlideForm (Next Experience) - setLabelOf(String fieldName, String label) {#ariaid-title65}

Sets the plain text value of the specified field label.
Note:  
This method isn't supported by Service Catalog.
{#GFNX-setLabelOf_S_S__table_h5q_ytw_ts__entry__3}{#GFNX-setLabelOf_S_S__g_form-setLabelOf-fieldName-entry}{#GFNX-setLabelOf_S_S__g_form-setLabelOf-label-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field for which to set the label. |
| label | String | Plain text value to set in the label. |
[Table 127. Parameters]

{#GFNX-setLabelOf_S_S__table_h5q_ytw_ts} {#GFNX-setLabelOf_S_S__table_i5q_ytw_ts__entry__2}

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

{#GFNX-setLabelOf_S_S__table_i5q_ytw_ts}  

    if (g_user.hasRole('itil')) {
        var oldLabel = g_form.getLabelOf('comments');
        g_form.setLabelOf('comments', oldLabel + ' (Customer visible)');
    }

## GlideForm (Next Experience) - setMandatory(String fieldName, Boolean mandatory) {#ariaid-title66}

Makes the specified field mandatory.
Mandatory fields are visually distinguished by an asterisk next to the field label. The asterisk is red if the field is empty, and black if the field is not empty. The system displays a
validation message if a user attempts to save or submit the form without completing those fields. For more information, see [Form fields](https://www.servicenow.com/docs/access?context=c_FormFields&version=zurich&pubname=zurich-platform-user-interface&ft:locale=en-US).  
Note:  
Whenever possible, use a UI policy rather than this method.
{#GFNX-setMandatory_S_B__table_xnx_z4c_5s__entry__3}{#GFNX-setMandatory_S_B__g_form-setMandatory-fieldName-entry}{#GFNX-setMandatory_S_B__g_form-setMandatory-mandatory-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field to make mandatory. |
| mandatory | Boolean | Flag that indicates whether the field is mandatory. Valid values: * true: Field is mandatory. * false: Field is optional. {#GFNX-setMandatory_S_B__ul_ofd_sqg_5fc} Default: false |
[Table 129. Parameters]

{#GFNX-setMandatory_S_B__table_xnx_z4c_5s} {#GFNX-setMandatory_S_B__table_ynx_z4c_5s__entry__2}

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

{#GFNX-setMandatory_S_B__table_ynx_z4c_5s}

## GlideForm (Next Experience) - setReadOnly(String fieldName, Boolean readOnly) {#ariaid-title67}

Makes the specified field read-only or editable.
Whenever possible, use a UI policy instead of this method.

To make a mandatory field read-only, you must first remove the mandatory requirement for that field by using the setMandatory() method.

Once you set a field to read-only, you cannot use the [setValue()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-setValue_S_S "Sets the value of a specified form field to the specified value.") method to update the value of that field. If you need to set the value in this way, you must set the readOnly value to `false.`
{#GFNX-setReadOnly_S_B__table_xdf_qpc_5s__entry__3}{#GFNX-setReadOnly_S_B__g_form-setReadOnly-fieldName-entry}{#GFNX-setReadOnly_S_B__g_form-setReadOnly-readOnly-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field whose access value to set. |
| readOnly | Boolean | Flag that determines whether the associate field is editable or read-only. Valid values: * true: Set field to read-only. * false: Set field to be editable. {#GFNX-setReadOnly_S_B__ul_tfd_sqg_5fc} |
[Table 131. Parameters]

{#GFNX-setReadOnly_S_B__table_xdf_qpc_5s} {#GFNX-setReadOnly_S_B__table_ydf_qpc_5s__entry__2}

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

{#GFNX-setReadOnly_S_B__table_ydf_qpc_5s}  
The following example shows how set the Variable Editor to read only. To do this in Service Catalog tables, use setVariablesReadOnly().

    // Create a Client Script on a table (e.g., incident) and paste this script
    // Uncheck (set to false) the "isolate script" checkbox (not available by default)
    // To add the isolate script checkbox to the form, configure form layout to add the checkbox
    function onLoad() { 
      $("variable_map").querySelectorAll("item").forEach(function(item){
        var variable = item.getAttribute("qname"); 
        g_form.setReadOnly("variables."+ variable, true); 
      }); 
    }

## GlideForm (Next Experience) - setSectionDisplay(String sectionName, Boolean display) {#ariaid-title68}

Shows or hides a specified section in the form.
{#GFNX-setSectionDisplay_S_B__table_pqq_qqd_5s__entry__3}{#GFNX-setSectionDisplay_S_B__g_form-setSectionDisplay-sectionName-entry}{#GFNX-setSectionDisplay_S_B__g_form-setSectionDisplay-display-entry}

| Name | Type | Description |
|-|-|-|
| sectionName | String | Section name is lower case with an underscore replacing the first space in the name, and with the remaining spaces being removed. For example, "Section Four is Here" becomes "section_fourishere". Other non-alphanumeric characters, such as ampersands (\&), are removed. Section names can be found by using the getSectionNames() method. |
| display | Boolean | Flag that indicates whether to show the section. Valid values: * true: Show the section. * false: Hide the section. {#GFNX-setSectionDisplay_S_B__ul_odd_sqg_5fc} |
[Table 133. Parameters]

{#GFNX-setSectionDisplay_S_B__table_pqq_qqd_5s} {#GFNX-setSectionDisplay_S_B__table_qqq_qqd_5s__entry__2}{#GFNX-setSectionDisplay_S_B__g_form-setSectionDisplay-returns-entry}

| Type | Description |
|-|-|
| Boolean | Returns true when successful. |
[Table 134. Returns]

{#GFNX-setSectionDisplay_S_B__table_qqq_qqd_5s}

## GlideForm (Next Experience) - setValue(String fieldName, String value) {#ariaid-title69}

Sets the value of a specified form field to the specified value.
This method also supports setting values in a multi-row variable set (MRVS). You must first use `JSON.parse(getValue('<mrvs_field_name>'))` to obtain the MRVS array and then use indexing to update the fields
within the row objects. Once all values are updated in the MRVS, use the setValue() method to save the updated MRVS array. For more details, see the code example below.  
Note:  
The method setValue() can cause a stack overflow when used in an OnChange client script. This is because every time the value is set, it will register as a change, which may re-trigger the OnChange client script. To prevent this, perform a check that will validate that the new value will be different from the old value. For example, before performing `setValue(shortDesc, newValue.toUpperCase());`, validate that the short description is not already uppercase. This will prevent the client script from applying the toUpperCase() more than once.
{#GFNX-setValue_S_S__table_bqz_pqc_5s__entry__3}{#GFNX-setValue_S_S__g_form-setValue-fieldName-entry}{#GFNX-setValue_S_S__g_form-setValue2-fieldName-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the form field to update. |
| value | String | Value to set in the specified field. Note: When defining a value in a choice list, be sure to use the number value rather than the label. |
[Table 135. Parameters]

{#GFNX-setValue_S_S__table_bqz_pqc_5s} {#GFNX-setValue_S_S__table_cqz_pqc_5s__entry__2}

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

{#GFNX-setValue_S_S__table_cqz_pqc_5s}  
The following example shows how to set the short description in the current form.

    g_form.setValue('short_description', 'replace this with appropriate text');

The following example shows how to set values in an MRVS. In this example, salaries are being managed through the Service Catalog. The client script searches all rows within the MRVS for the value entered in the Job title and then updates the matching entries within the MRVS with what is entered in the Salary field. The MRVS is named "variable_set_1" and contains the following fields within each row
object: Employee name \[employee_name\], Job title \[employee_job_title\], and Salary \[employee_salary\]. In addition, the Catalog Item contains: Job title \[job_title\] and Salary \[salary\].

    function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
    return;
    }

    // Get the MRVS
    var multiRowVariableSet = JSON.parse(g_form.getValue('variable_set_1'));

    for (var i = 0; i < multiRowVariableSet.length; i++) {
    // Check if the entered job title matches the title in the current MRVS row
      if (multiRowVariableSet[i].employee_job_title == g_form.getValue("job_title")){
        // Update the value of a matching field with the new salary
        multiRowVariableSet[i].employee_salary = newValue;
      }
    }

    // Update the MRVS
    g_form.setValue('variable_set_1', JSON.stringify(multiRowVariableSet));
    }

## GlideForm (Next Experience) - setValue(String fieldName, String value, String displayValue) {#ariaid-title70}

Sets the value of a specified form field to the value of a specified display value in a reference record.
To improve performance by preventing a round trip when setting the value for a reference field, use this method, not setValue(fieldName, value). When setting multiple reference values for a list collector
field, pass arrays in the value and displayValue parameters.  
Note:  
The method setValue() can cause a stack overflow when used in an `onchange` client script. This is because every time the value is set, it will register as a change, which may re-trigger the OnChange client script. To prevent this, perform a check that will validate that the new value will be different from the old value. For example, before performing `setValue(shortDesc,
newValue.toUpperCase());`, validate that the short description is not already uppercase. This will prevent the client script from applying the toUpperCase() more than once.
{#GFNX-setValue_S_S_S__table_oxn_vrc_5s__entry__3}{#GFNX-setValue_S_S_S__g_form-setValue-fieldName-entry}{#GFNX-setValue_S_S_S__g_form-setValue-value-entry}{#GFNX-setValue_S_S_S__g_form-setValue-displayValue-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the form field to update. |
| value | String or Array | Sys_id of the reference record to use to update the field. If the specified field is a GlideList, this parameter can contain an array of sys_ids. In this case, the method performs a lookup of all records specified in the array and those values are used to update the contents of the specified field (related list). Note: When defining a value in a choice list, be sure to use a number value rather than the label. |
| displayValue | String or Array | Field within the specified reference record to use to update the specified field. For example, in the User \[sys_user\] table it might be userName. If the specified field is a GlideList, this parameter can contain an array of display value names. For additional information on display values, see [Display value](https://www.servicenow.com/docs/access?context=c_DisplayValues&version=zurich&pubname=zurich-platform-administration&ft:locale=en-US). |
[Table 137. Parameters]

{#GFNX-setValue_S_S_S__table_oxn_vrc_5s} {#GFNX-setValue_S_S_S__table_pxn_vrc_5s__entry__2}

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

{#GFNX-setValue_S_S_S__table_pxn_vrc_5s}  
This example shows passing the sys_id of the reference record that contains the userName field to use to update the assigned_to form field.

    g_form.setValue('assigned_to', userSysID, userName);

This example shows passing an array of reference record sys_ids and an array of corresponding display value names to use to update the form fields in the GlideList glide-list_field_name.

    g_form.setValue('glide-list_field_name', sysIDArray, displayNameArray);

## GlideForm (Next Experience) - setVariablesReadOnly(Boolean isReadOnly) {#ariaid-title71}

Makes a Service Catalog variable editor read only.
Note:  
This method is only applicable to Service Catalog variable editors in the core UI. This method is not supported in the Service Catalog form.

The method must be placed in the client script of the table in which the variable editor is added, such as Requested Item \[sc_req_item\], Incident \[incident\], and so on. To set variables to read only in other tables, use the [setReadOnly()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-setReadOnly_S_B "Makes the specified field read-only or editable.") method.

See also: [Service Catalog variable editors](https://www.servicenow.com/docs/access?context=service-catalog-variable-editor&version=zurich&pubname=zurich-servicenow-platform&ft:locale=en-US)
{#GFNX-setVariablesReadOnly_B__table_xdf_qpc_5s__entry__3}{#GFNX-setVariablesReadOnly_B__g_form-setVariablesReadOnly-isReadOnly-entry}

| Name | Type | Description |
|-|-|-|
| isReadOnly | Boolean | Flag that determines whether the variable editor is read only. Valid values: * true: Sets the variable editor as read-only. * false: Sets the variable editor as editable. {#GFNX-setVariablesReadOnly_B__ul_ifd_sqg_5fc} Default: false |
[Table 139. Parameters]

{#GFNX-setVariablesReadOnly_B__table_xdf_qpc_5s} {#GFNX-setVariablesReadOnly_B__table_ydf_qpc_5s__entry__2}

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

{#GFNX-setVariablesReadOnly_B__table_ydf_qpc_5s}  
Adding the following line to a client script sets the variable editor to read only.

    g_form.setVariablesReadOnly(true);

## GlideForm (Next Experience) - setVisible(String fieldName, Boolean display) {#ariaid-title72}

Displays or hides the specified field.
On desktop UI, the space is left blank when hidden. On Mobile or Service Portal UI, the space is filled in my other fields when hidden. This method can't hide mandatory fields with no value.

Use UI Policy rather than this method whenever possible.
{#GFNX-setVisible_S_B__table_k24_45w_ts__entry__3}{#GFNX-setVisible_S_B__g_form-setVisible-fieldName-entry}{#GFNX-setVisible_S_B__g_form-setVisible-display-entry}

| Name | Type | Description |
|-|-|-|
| fieldName | String | Name of the field to display or hide. |
| display | Boolean | Flag that indicates whether to display the specified field. Valid values: * true: Display the field. * false: Hide the field. {#GFNX-setVisible_S_B__ul_c2d_sqg_5fc} |
[Table 141. Parameters]

{#GFNX-setVisible_S_B__table_k24_45w_ts} {#GFNX-setVisible_S_B__table_l24_45w_ts__entry__2}

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

{#GFNX-setVisible_S_B__table_l24_45w_ts}  

    function onChange(control, oldValue, newValue, isLoading, isTemplate) {
       //If the page isn't loading
       if (!isLoading) {
          //If the new value isn't blank
          if(newValue != '') {
             g_form.setVisible('priority', false); 
          }
          else
             g_form.setVisible('priority', true); 
          }
       }

## GlideForm (Next Experience) - showAnnotation(String name) {#ariaid-title73}

Shows an annotation with a given name on the form UI.
[Annotations](https://www.servicenow.com/docs/access?context=configure-form-layout&version=zurich&pubname=zurich-platform-administration&section=t_AddAFormAnnotation&ft:locale=en-US) are visual separators between form elements, or blocks of colored text used to highlight form elements. See also:

* [GlideForm (Next Experience) - hideAnnotation(String name)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-hideAnnotation_S "Hides an annotation with a given name on the form UI.") to hide a specific annotation on the form.
* [GlideForm (Next Experience) - toggleAnnotations()](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-toggleAnnotations "Hides or shows all annotations on the form.") to toggle annotations on and off with greater flexibility.
{#GFNX-showAnnotation_S__ul_rbd_2mf_wfc}
{#GFNX-showAnnotation_S__table_isv_1nt_rfc__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the annotation to show in the form. Table: Form Annotations \[sys_ui_annotation\], Field: Name |
[Table 143. Parameters]

{#GFNX-showAnnotation_S__table_isv_1nt_rfc} {#GFNX-showAnnotation_S__table_jsv_1nt_rfc__entry__2}

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

{#GFNX-showAnnotation_S__table_jsv_1nt_rfc}  
The following example demonstrates how to programmatically show the annotation named test-annotation-msg on the form field using the showAnnotation() method.

    g_form.showAnnotation('test-annotation-msg');

## GlideForm (Next Experience) - showErrorBox(String name, String message) {#ariaid-title74}

Displays an error message under the specified form field (either a control object or the name of the field). If the control or field is currently off the screen, the form automatically scrolls to the control or field.
A global property (glide.ui.scroll_to_message_field) is available that controls automatic message scrolling when the form field is off screen (scrolls the form to the control or field). The showFieldMsg()
method is a similar method that requires a type parameter.
{#GFNX-showErrorBox_String_String__table_rxv_2vw_ts__entry__3}{#GFNX-showErrorBox_String_String__g_form-showErrorBox-name-entry}{#GFNX-showErrorBox_String_String__g_form-showErrorBox-message-entry}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the field or control under which to display the error message. |
| message | String | Error message to display. |
[Table 145. Parameters]

{#GFNX-showErrorBox_String_String__table_rxv_2vw_ts} {#GFNX-showErrorBox_String_String__table_sxv_2vw_ts__entry__2}

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

{#GFNX-showErrorBox_String_String__table_sxv_2vw_ts}

## GlideForm (Next Experience) - showErrorBox(String name, String message, Boolean scrollForm) {#ariaid-title75}

Displays an error message under the specified form field (either a control object or the name of the field). If the control or field is currently off the screen and the scrollForm parameter is true, the form scrolls to the control or field.
A global property (glide.ui.scroll_to_message_field) is available that controls automatic message scrolling when the form field is off screen (scrolls the form to the control or field). The showFieldMsg()
method is a similar method that requires a type parameter.
{#GFNX-showErrorBox_S_S_B__table_lyr_dww_ts__entry__3}{#GFNX-showErrorBox_S_S_B__g_form-showErrorBox-name-entry}{#GFNX-showErrorBox_S_S_B__g_form-showErrorBox-message-entry}{#GFNX-showErrorBox_S_S_B__g_form-showErrorBox-scrollForm-entry}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the field or control under which to display the error message. |
| message | String | Error message to display. |
| scrollForm | Boolean | Flag that indicates whether to automatically scroll the form to the error message field. Valid values: * true: Scroll to the error message field. * false: Don't scroll to the error message field. {#GFNX-showErrorBox_S_S_B__ul_bgd_sqg_5fc} Default: true |
[Table 147. Parameters]

{#GFNX-showErrorBox_S_S_B__table_lyr_dww_ts} {#GFNX-showErrorBox_S_S_B__table_myr_dww_ts__entry__2}

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

{#GFNX-showErrorBox_S_S_B__table_myr_dww_ts}

## GlideForm (Next Experience) - showFieldMsg(String field, String message, String type) {#ariaid-title76}

Displays a message under the specified form field (either a control object or the name of the field). If the control or field is off the screen, the method automatically scrolls the form to that field.
A global property (glide.ui.scroll_to_message_field) is available that controls automatic message scrolling when the form field is off screen (scrolls the form to the control or field).

The showErrorBox() method is a shorthand method that does not require the type parameter.  
Note:  
This method does not work with the journal_field type field in Core UI.
{#GFNX-showFieldMsg_S_S_S__table_u3z_hxw_ts__entry__3}{#GFNX-showFieldMsg_S_S_S__g_form-showFieldMsg-field-entry}{#GFNX-showFieldMsg_S_S_S__g_form-showFieldMsg-message-entry}{#GFNX-showFieldMsg_S_S_S__g_form-showFieldMsg-type-entry}

| Name | Type | Description |
|-|-|-|
| field | String | Name of the field or control under which to display the message. |
| message | String | Message to display. |
| type | String | Type of message. Valid values: * error * info * warning {#GFNX-showFieldMsg_S_S_S__ul_vgd_sqg_5fc} |
[Table 149. Parameters]

{#GFNX-showFieldMsg_S_S_S__table_u3z_hxw_ts} {#GFNX-showFieldMsg_S_S_S__table_v3z_hxw_ts__entry__2}

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

{#GFNX-showFieldMsg_S_S_S__table_v3z_hxw_ts}  

    g_form.showFieldMsg('impact','Low impact response time can be one week','info');

## GlideForm (Next Experience) - showFieldMsg(String field, String message, String type, Boolean scrollForm) {#ariaid-title77}

Displays a message under the specified form field (either a control object or the name of the field). If the control or field is currently off the screen and scrollForm is `true`, the method scrolls the form to that field.
A global property (glide.ui.scroll_to_message_field) is available that controls automatic message scrolling when the form field is off screen (scrolls the form to the control or field).

The showErrorBox() method is a shorthand method that does not require the type parameter.  
Note:  
This method does not work with the journal_field type field in Core UI.
{#GFNX-showFieldMsg_S_S_S_B__table_wmr_gyw_ts__entry__3}{#GFNX-showFieldMsg_S_S_S_B__g_form-showFieldMsg-field-entry}{#GFNX-showFieldMsg_S_S_S_B__g_form-showFieldMsg-message-entry}{#GFNX-showFieldMsg_S_S_S_B__g_form-showFieldMsg-type-entry}{#GFNX-showFieldMsg_S_S_S_B__g_form-showFieldMsg-scrollForm-entry}

| Name | Type | Description |
|-|-|-|
| field | String | Name of the field or control under which to display the message. |
| message | String | Message to display. |
| type | String | Type of message. Valid values: * error * info * warning {#GFNX-showFieldMsg_S_S_S_B__ul_vgd_sqg_5fc} |
| scrollForm | Boolean | Flag that indicates whether to automatically scroll the form to the message field. Valid values: * true: Scroll to the message field. * false: Don't scroll to the message field. {#GFNX-showFieldMsg_S_S_S_B__ul_hgd_sqg_5fc} Default: true |
[Table 151. Parameters]

{#GFNX-showFieldMsg_S_S_S_B__table_wmr_gyw_ts} {#GFNX-showFieldMsg_S_S_S_B__table_xmr_gyw_ts__entry__2}

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

{#GFNX-showFieldMsg_S_S_S_B__table_xmr_gyw_ts}  

    g_form.showFieldMsg('impact','Low impact not allowed with High priority','error',false);

## GlideForm (Next Experience) - showRelatedList(String listTableName) {#ariaid-title78}

Displays the specified related list on the form.
This method isn't available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-showRelatedList_S__table_mps_2zw_ts__entry__3}{#GFNX-showRelatedList_S__g_form-showRelatedList-listTableName-entry}

| Name | Type | Description |
|-|-|-|
| listTableName | String | Name of the related list to display. |
[Table 153. Parameters]

{#GFNX-showRelatedList_S__table_mps_2zw_ts} {#GFNX-showRelatedList_S__table_nps_2zw_ts__entry__2}

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

{#GFNX-showRelatedList_S__table_nps_2zw_ts}

## GlideForm (Next Experience) - showRelatedLists() {#ariaid-title79}

Displays all the form's related lists.
This method isn't available on the mobile platform. If this method is run on a mobile platform, no action occurs.
{#GFNX-showRelatedLists__table_jcj_rzw_ts__entry__3}

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

{#GFNX-showRelatedLists__table_jcj_rzw_ts} {#GFNX-showRelatedLists__table_kcj_rzw_ts__entry__2}

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

{#GFNX-showRelatedLists__table_kcj_rzw_ts}

## GlideForm (Next Experience) - submit() {#ariaid-title80}

Saves the record.
The user is taken away from the form, returning them to where they were.
{#GFNX-submit__table_nhk_grd_5s__entry__3}

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

{#GFNX-submit__table_nhk_grd_5s} {#GFNX-submit__table_ohk_grd_5s__entry__2}

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

{#GFNX-submit__table_ohk_grd_5s}

## GlideForm (Next Experience) - submit(String verb) {#ariaid-title81}

Performs the specified UI action.
{#GFNX-submit_S__table_o1z_d3p_qx__entry__3}{#GFNX-submit_S__g_form-submit-verb-entry}

| Name | Type | Description |
|-|-|-|
| verb | String | An action_name from a sys_ui_action record. The action name must be for a visible form button. |
[Table 159. Parameters]

{#GFNX-submit_S__table_o1z_d3p_qx} {#GFNX-submit_S__table_p1z_d3p_qx__entry__2}

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

{#GFNX-submit_S__table_p1z_d3p_qx}

## GlideForm (Next Experience) - toggleAnnotations() {#ariaid-title82}

Hides or shows all annotations on the form.
[Annotations](https://www.servicenow.com/docs/access?context=configure-form-layout&version=zurich&pubname=zurich-platform-administration&section=t_AddAFormAnnotation&ft:locale=en-US) are visual separators between form elements, or blocks of colored text used to highlight form elements. If annotations are visible on the form, calling toggleAnnotations() hides them. Similarly if annotations are hidden on the form, calling this method displays them. See also:

* [GlideForm (Next Experience) - hideAnnotation(String name)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-hideAnnotation_S "Hides an annotation with a given name on the form UI.")
* [GlideForm (Next Experience) - showAnnotation(String name)](https://www.servicenow.com/docs/a3hbepIg9Dce2tCf4NvM5A#GFNX-showAnnotation_S "Shows an annotation with a given name on the form UI.")
{#GFNX-toggleAnnotations__ul_ytp_ytm_5fc}
{#GFNX-toggleAnnotations__table_xqy_vjz_rfc__entry__3}

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

{#GFNX-toggleAnnotations__table_xqy_vjz_rfc} {#GFNX-toggleAnnotations__table_yqy_vjz_rfc__entry__2}

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

{#GFNX-toggleAnnotations__table_yqy_vjz_rfc}  
The following example shows how to call toggleAnnotations() to show or hide form annotations. As a result, annotations are hidden or shown depending on their previous state.

    g_form.toggleAnnotations();


