---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# モバイル GlideForm (g_form): クライアント

# モバイル GlideForm (g_form): クライアント {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：4分

Mobile GlideForm (g_form) API は、モバイルプラットフォームでフォームを操作するためのメソッドを提供します。

これらのメソッドは、モバイルデバイスをターゲットとする任意のスクリプトで使用します。

## MobileGlideForm (g_form) - addDecoration(String fieldName, String icon, String text) {#ariaid-title2}

フィールドの横に装飾アイコンを追加します。
{#r_MGF-addDecoration_S_S_S__table_nbc_4dw_mt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| fieldName | 文字列 | フィールド名 |
| icon | 文字列 | フィールドの横に表示するフォントアイコン。 |
| テキスト | 文字列 | アイコンのテキストタイトル (スクリーンリーダーに使用)。 |
[表 : 1. パラメーター]

{#r_MGF-addDecoration_S_S_S__table_nbc_4dw_mt} {#r_MGF-addDecoration_S_S_S__table_obc_4dw_mt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 2. 返される内容]

{#r_MGF-addDecoration_S_S_S__table_obc_4dw_mt}  
この例では、発信者の横に VIP アイコンを追加します。

    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');			
          });
          }

## MobileGlideForm (g_form) - getLabel(文字列 fieldName) {#ariaid-title3}

フォームラベルテキストを取得します。
{#r_MGF-getLabel_S__table_jbc_4dw_mt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| fieldName | 文字列 | フィールド名 |
[表 : 3. パラメーター]

{#r_MGF-getLabel_S__table_jbc_4dw_mt} {#r_MGF-getLabel_S__table_kbc_4dw_mt__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | ラベルテキスト。 |
[表 : 4. 返される内容]

{#r_MGF-getLabel_S__table_kbc_4dw_mt}  

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

## MobileGlideForm (g_form) - hasField(文字列 fieldName) {#ariaid-title4}

フィールドがフォームに存在するかどうかを判定します。
存在するということは、表示できるということではなく、表示できることを意味します。
{#r_MGF-hasField_S__table_lbc_4dw_mt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| fieldName | 文字列 | 検索するフィールド。 |
[表 : 5. パラメーター]

{#r_MGF-hasField_S__table_lbc_4dw_mt} {#r_MGF-hasField_S__table_mbc_4dw_mt__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | フィールドがフォームに存在する場合は True。そうでない場合は false。フォーム上にあるということは、フィールドがg_formの一部であることを意味します。これは、非表示、読み取り専用、必須、または無効である可能性があります。 |
[表 : 6. 返される内容]

{#r_MGF-hasField_S__table_mbc_4dw_mt}  
この例では、\[assignment_group\] フィールドがフォーム上にある場合、\[assigned_to\] フィールドを必須にします。

    if (g_form.hasField('assignment_group'))
          g_form.setMandatory('assigned_to', true);
        
## MobileGlideForm (g_form) - removeDecoration(String fieldName, String icon, String text) {#ariaid-title5}

フィールドの横から装飾アイコンを削除します。
{#r_MGF-removeDecoration_S_S_S__table_q5v_wvw_mt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| fieldName | 文字列 | フィールド名 |
| icon | 文字列 | 削除するアイコン。 |
| テキスト | 文字列 | アイコンのテキストタイトル。 |
[表 : 7. パラメーター]

{#r_MGF-removeDecoration_S_S_S__table_q5v_wvw_mt} {#r_MGF-removeDecoration_S_S_S__table_t5v_wvw_mt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 8. 返される内容]

{#r_MGF-removeDecoration_S_S_S__table_t5v_wvw_mt}  

    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');			
          });
          }

## MobileGlideForm (g_form) - setLabel(文字列 fieldName, 文字列ラベル) {#ariaid-title6}

フォームラベルテキストを設定します。
{#r_MGF-setLabel_S_S__table_fbc_4dw_mt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| fieldName | 文字列 | フィールド名 |
| label | 文字列 | フィールドラベルのテキスト。 |
[表 : 9. パラメーター]

{#r_MGF-setLabel_S_S__table_fbc_4dw_mt} {#r_MGF-setLabel_S_S__table_gbc_4dw_mt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 10. 返される内容]

{#r_MGF-setLabel_S_S__table_gbc_4dw_mt}  
この例では、コメントラベルを変更します。

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


