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

 Release :

    - xanadu

ft:locale :

    - de-DE

ft:publication_title :

    - Xanadu-API-Referenz

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Mobile GlideForm (g_form) : Client

# Mobile GlideForm (g_form) : Client {#ariaid-title1}

* Freigeben Version: Xanadu
* 
* Aktualisiert 1. August 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 Minute Lesedauer

Die Mobile GlideForm-API (g_form) bietet Methoden zum Arbeiten mit Formularen auf der mobilen Plattform.

Verwenden Sie diese Methoden in jedem Skript, das auf ein mobiles Gerät abzielt.

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

Fügt ein dekoratives Symbol neben einem Feld hinzu.
{#r_MGF-addDecoration_S_S_S__table_nbc_4dw_mt__entry__3}

| Name | Typ | Beschreibung |
|-|-|-|
| fieldName | Zeichenfolge | Der Feldname. |
| icon | Zeichenfolge | Das Schriftartsymbol, das neben dem Feld angezeigt wird. |
| text | Zeichenfolge | Der Texttitel für das Symbol (wird für Bildschirmleseprogramme verwendet). |
[Tabelle : 1. Parameter]

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

| Typ | Beschreibung |
|-|-|
| void |   |
[Tabelle : 2. Ergebnisse]

{#r_MGF-addDecoration_S_S_S__table_obc_4dw_mt}  
In diesem Beispiel wird ein VIP-Symbol neben dem Aufrufer hinzugefügt.

    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(String fieldName) {#ariaid-title3}

Ruft den Formularbeschriftungstext ab.
{#r_MGF-getLabel_S__table_jbc_4dw_mt__entry__3}

| Name | Typ | Beschreibung |
|-|-|-|
| fieldName | Zeichenfolge | Der Feldname. |
[Tabelle : 3. Parameter]

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

| Typ | Beschreibung |
|-|-|
| Zeichenfolge | Beschriftungstext. |
[Tabelle : 4. Ergebnisse]

{#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(String fieldName) {#ariaid-title4}

Bestimmt, ob ein Feld im Formular vorhanden ist.
Vorhanden bedeutet, dass es anzeigt werden kann, nicht dass es sichtbar ist.
{#r_MGF-hasField_S__table_lbc_4dw_mt__entry__3}

| Name | Typ | Beschreibung |
|-|-|-|
| fieldName | Zeichenfolge | Das zu suchende Feld. |
[Tabelle : 5. Parameter]

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

| Typ | Beschreibung |
|-|-|
| Boolean | „true", wenn das Feld im Formular vorhanden ist. Andernfalls „false". Im Formular bedeutet, dass das Feld Teil von g_form ist. Es kann immer noch ausgeblendet, schreibgeschützt, obligatorisch oder ungültig sein. |
[Tabelle : 6. Ergebnisse]

{#r_MGF-hasField_S__table_mbc_4dw_mt}  
In diesem Beispiel ist das Feld „assigned_to" ein Pflichtfeld, wenn sich das Feld „assignment_group" im Formular befindet.

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

Entfernt ein dekoratives Symbol neben einem Feld.
{#r_MGF-removeDecoration_S_S_S__table_q5v_wvw_mt__entry__3}

| Name | Typ | Beschreibung |
|-|-|-|
| fieldName | Zeichenfolge | Der Feldname. |
| icon | Zeichenfolge | Zu entfernendes Symbol. |
| text | Zeichenfolge | Texttitel für das Symbol. |
[Tabelle : 7. Parameter]

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

| Typ | Beschreibung |
|-|-|
| void |   |
[Tabelle : 8. Ergebnisse]

{#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(String fieldName, String label) {#ariaid-title6}

Legt den Text der Formularbeschriftung fest.
{#r_MGF-setLabel_S_S__table_fbc_4dw_mt__entry__3}

| Name | Typ | Beschreibung |
|-|-|-|
| fieldName | Zeichenfolge | Der Feldname. |
| label | Zeichenfolge | Feldbeschriftungstext. |
[Tabelle : 9. Parameter]

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

| Typ | Beschreibung |
|-|-|
| void |   |
[Tabelle : 10. Ergebnisse]

{#r_MGF-setLabel_S_S__table_gbc_4dw_mt}  
In diesem Beispiel wird die Kommentarbezeichnung geändert.

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


