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

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideMenu (g_menu and g_item) - Client

# GlideMenu (g_menu and g_item) - Client {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The GlideMenu API provides methods that can be used in UI context menus and in `onShow` scripts to customize UI context menu items.  
There is no constructor for the GlideMenu class. Access GlideMenu methods using the `g_menu` global object.

* `g_menu` is the UI context menu that is about to be shown. The `onShow` script can make changes to the appearance of the menu before it is displayed using these methods.
* `g_item` is the current UI context menu item that is about to be shown. It is used in several of the g_menu methods to specify an item.
{#c_GlideMenuAPI__ul_thk_zzw_hv}

## GlideMenu - clearImage(GlideMenuItem item) {#ariaid-title2}

Clears the image for an item.
{#r_GM-clearImage_GMI__table_k1g_m1x_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | Specifies the item to have its image removed from display. |
[Table 1. Parameters]

{#r_GM-clearImage_GMI__table_k1g_m1x_hv} {#r_GM-clearImage_GMI__table_l1g_m1x_hv__entry__2}

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

{#r_GM-clearImage_GMI__table_l1g_m1x_hv}  

    g_menu.clearImage(g_item);

## GlideMenu - clearSelected() {#ariaid-title3}

Clears any selection images from items in the menu.
{#r_GM-clearSelected__table_wtx_x1x_hv__entry__3}

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

{#r_GM-clearSelected__table_wtx_x1x_hv} {#r_GM-clearSelected__table_xtx_x1x_hv__entry__2}

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

{#r_GM-clearSelected__table_xtx_x1x_hv}

## GlideMenu - getItem(String itemID) {#ariaid-title4}

Returns a menu item by item ID.
It can be necessary to find an item in a menu so that it can be changed before being
displayed. Each menu item may be assigned a unique ID when the menu item is created (either
from a UI Context Menu entry or from the addAction() method in the
Dynamic Script Action).
{#r_GM-getItem_S__table_tnn_gbx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| itemID | String | Specifies the item to be returned. |
[Table 5. Parameters]

{#r_GM-getItem_S__table_tnn_gbx_hv} {#r_GM-getItem_S__table_unn_gbx_hv__entry__2}

| Type | Description |
|-|-|
| GlideMenuItem | The menu item |
[Table 6. Returns]

{#r_GM-getItem_S__table_unn_gbx_hv}

## GlideMenu - setDisabled(GlideMenuItem item) {#ariaid-title5}

Disables a menu item so that it cannot be selected. The disabled menu item is displayed
in a lighter color (grayed out) to indicate it is disabled.
{#r_GM-setDisabled_GMI__table_d21_5bx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | The item to be disabled. |
[Table 7. Parameters]

{#r_GM-setDisabled_GMI__table_d21_5bx_hv} {#r_GM-setDisabled_GMI__table_e21_5bx_hv__entry__2}

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

{#r_GM-setDisabled_GMI__table_e21_5bx_hv}  

    g_menu.setDisabled(g_item);

## GlideMenu - setEnabled(GlideMenuItem item) {#ariaid-title6}

Enables the specified menu item.
{#r_GM-setEnabled_GMI__table_hb4_gcx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | The item to be enabled. |
[Table 9. Parameters]

{#r_GM-setEnabled_GMI__table_hb4_gcx_hv} {#r_GM-setEnabled_GMI__table_ib4_gcx_hv__entry__2}

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

{#r_GM-setEnabled_GMI__table_ib4_gcx_hv}  

    g_menu.setEnabled(g_item);

## GlideMenu - setHidden(GlideMenuItem item) {#ariaid-title7}

Hides the specified menu item.
When hiding menu items, the separator bars are not adjusted, so it is possible to end up
with the menu showing two separators in a row.
{#r_GM-setHidden_GMI__table_g3l_scx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | The item to be hidden. |
[Table 11. Parameters]

{#r_GM-setHidden_GMI__table_g3l_scx_hv} {#r_GM-setHidden_GMI__table_h3l_scx_hv__entry__2}

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

{#r_GM-setHidden_GMI__table_h3l_scx_hv}  

    g_menu.setHidden(g_item);

## GlideMenu - setImage(GlideMenuItem item, String imgSrc) {#ariaid-title8}

Sets an image for an item.
{#r_GM-setImage_GMI_S__table_w1f_2dx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | the item to have the image displayed. |
| imgSrc | String | the image to attach to the menu item. |
[Table 13. Parameters]

{#r_GM-setImage_GMI_S__table_w1f_2dx_hv} {#r_GM-setImage_GMI_S__table_x1f_2dx_hv__entry__2}

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

{#r_GM-setImage_GMI_S__table_x1f_2dx_hv}  

    g_menu.setImage(g_item, 'images/checked.gifx');

## GlideMenu - setLabel(GlideMenuItem item, String label) {#ariaid-title9}

Sets the display label for a menu item. The label may contain HTML.
{#r_GM-setLabel_GMI_S__table_ixl_rdx_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | the item to be labeled. |
| label | String | the label to be displayed. The string may contain HTML. |
[Table 15. Parameters]

{#r_GM-setLabel_GMI_S__table_ixl_rdx_hv} {#r_GM-setLabel_GMI_S__table_jxl_rdx_hv__entry__2}

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

{#r_GM-setLabel_GMI_S__table_jxl_rdx_hv}  

    g_menu.setLabel(g_item, "This is a new label");

## GlideMenu - setVisible(GlideMenuItem item) {#ariaid-title10}

Displays the specified item.
{#r_GM-setVisible_GMI__table_y2z_f2x_hv__entry__3}

| Name | Type | Description |
|-|-|-|
| item | GlideMenuItem | The item to be displayed. |
[Table 17. Parameters]

{#r_GM-setVisible_GMI__table_y2z_f2x_hv} {#r_GM-setVisible_GMI__table_z2z_f2x_hv__entry__2}

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

{#r_GM-setVisible_GMI__table_z2z_f2x_hv}  

    g_menu.setVisible(g_item);


