Skip to content

Instantly share code, notes, and snippets.

@asimpkin
Created January 18, 2017 20:10
Show Gist options
  • Save asimpkin/d7e606b587308885e8729e5bf797ee7a to your computer and use it in GitHub Desktop.
Save asimpkin/d7e606b587308885e8729e5bf797ee7a to your computer and use it in GitHub Desktop.
ServiceNow Reference Qualifier - Simple for ICBC Agents to Companies
//Reference Qualifier Script to ensure users can only agents asscoaited with their own company
//SysID for Yoru Company : lfdkjslkajfsdlkajldkjalkdsjlkjadsljk
//If users matches your compamy then allow all agents
function GetICBCAgentsForCompany(company) {
var answer = ' ';
if (company != 'lfdkjslkajfsdlkajldkjalkdsjlkjadsljk'){
var agent = new GlideRecord('u_icbc_agent');
agent.addQuery('u_company',company);
agent.query();
while (agent.next()) {
if (answer.length > 0) {
answer += (',' + agent.sys_id);
}
}
return 'sys_idIN' + answer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment