高度なアプリ許容量のスクリプト例
admin ロールを持つユーザーは、サンプルの 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オペレーティングシステムのタイプを決定します。