Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to filter a catalog item reference variable based on the logged-in user’s segment description.

Ryota
Tera Guru

In a catalog item reference variable that uses the cmdb_ci_business_app table as the reference, how can I configure it so that, when the logged-in user’s segment description field in the sys_user table is “AAA”, only records whose Owning organization field in the cmdb_ci_business_app table is “AAA” are displayed as selectable options?

3 REPLIES 3

Dinesh Chilaka
Kilo Sage

Hi @Ryota ,

you can simply right the advanced reference qualifier as below,

javascript: 'owning_organization='+gs.getUser().getRecord().getValue('segment_description');

Replace with your field names in the above reference qualifier.

If my response helps, please mark my response as helpful and accept the solution

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Ryota 

Thank you for marking my response as helpful.

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader