---
sourceDocument: Xanadu モバイルの構成とナビゲーション
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/mobile

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu モバイルの構成とナビゲーション

ft:clusterId :

    - mobile

bundleId :

    - mobile

workflow :

    - Platform


---

# 詳細アプリ許可のサンプルスクリプト

# 詳細アプリ許可のサンプルスクリプト {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：3分

管理者ロールを持つユーザーは、サンプルの JSON スクリプトを使用して、スクリプト化された拡張ポイントを構成できます。管理者は、これらのスクリプト化された拡張ポイントを使用して、ServiceNow インスタンスにログインできるモバイルアプリを制限できます。これらのスクリプトは、許可されたモバイルアプリへのリダイレクトリンクを指定するためにも使用できます。

## スクリプト例 {#adv-app-allow-sample-script__section_xx4_rgm_xrb}

次のスクリプト例では、 モバイルエージェント アプリと Now Mobile アプリ を除くすべてのアプリをブロックします。

その他すべてのアプリは制限されています。このスクリプトは blocked_mobile_apps_redirect プロパティも使用します。エンドユーザーが許可されていないアプリでログインしようとすると、リダイレクトボタン付きのエラーメッセージが表示されます。このボタンをクリックすると、ServiceNow インスタンスへの接続が許可されているモバイルアプリにログインするようにエンドユーザーがリダイレクトされます。

    var CustomPreAuthProperties = Class.create(); 
    CustomPreAuthProperties.prototype = { 
        initialize: function() {}, 

        /** 
         * Returns a JSON object keyed by the custom property names. 
         */ 
        getProperties: function(input) { 
            var customProperties = {}; 
            if (input.clientType == "agent") { 
                customProperties['allowed_mobile_apps'] = 'com.servicenow.fulfiller'; 
                if (input.deviceType == 'android') { 
                    customProperties['blocked_mobile_apps_redirect'] =  
    				'https://play.google.com/store/apps/details?id=com.servicenow.fulfiller&hl=en_US&gl=US'; 
                } else { 
                    customProperties['blocked_mobile_apps_redirect'] =  
    				'https://apps.apple.com/us/app/servicenow-agent/id1446951408'; 
                } 
            } else if (input.clientType == 'request') { 
                customProperties['allowed_mobile_apps'] = 'com.servicenow.requestor'; 
                if (input.deviceType == 'android') { 
                    customProperties['blocked_mobile_apps_redirect'] =  
    				'https://play.google.com/store/apps/details?id=com.servicenow.requestor&hl=en_US&gl=US'; 
                } else { 
                    customProperties['blocked_mobile_apps_redirect'] =  
    				'https://apps.apple.com/us/app/now-mobile/id1469616608'; 
                } 
            } 

            return customProperties; 
        }, 

        type: 'CustomPreAuthProperties' 
    };

このサンプルスクリプトは、次の JSON オブジェクトを使用します。

* `input.clientType` は、モバイルアプリのタイプを決定します。
* `input.deviceType` は、オペレーティングシステムのタイプを決定します。
{#adv-app-allow-sample-script__ul_fb4_5wg_xrb}

