詳細アプリ許可のサンプルスクリプト
管理者ロールを持つユーザーは、サンプルの JSON スクリプトを使用して、スクリプト化された拡張ポイントを構成できます。管理者は、これらのスクリプト化された拡張ポイントを使用して、ServiceNow インスタンスにログインできるモバイルアプリを制限できます。これらのスクリプトは、許可されたモバイルアプリへのリダイレクトリンクを指定するためにも使用できます。
スクリプト例
次のスクリプト例では、 モバイルエージェント アプリと 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は、オペレーティングシステムのタイプを決定します。