ログインユーザーのセグメントに応じて Business Application の参照候補を絞り込む方法

Ryota
Tera Guru

カタログアイテムの変数(参照タイプ)で cmdb_ci_business_appテーブルを参照先にするのですが、
参照時にリストされる内容は、ログインユーザーのsys_userテーブル上にある「segment description」というカラムが「 AAA」の場合には、cmdb_ci_business_appテーブルの「Owning organization」というカラムが「AAA」のものだけ表示されるようするにはどういう設定で実現できますか?

1件の返信1

Ankur Bawiskar
Tera Patron

@Ryota 

something like this but please enhance, this should work in both scope app + global scope 

Note: I assume both the fields 1 that is on sys_user and other on cmdb_ci_business_app are of same type

javascript:
var query = '';
var val = '';
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", gs.getUserID());
gr.query();
if (gr.next()) {
    val = gr.owningFieldName.toString();
}
query = 'owning_organization=' + val;
query;

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader