Created
January 18, 2017 20:10
-
-
Save asimpkin/d7e606b587308885e8729e5bf797ee7a to your computer and use it in GitHub Desktop.
ServiceNow Reference Qualifier - Simple for ICBC Agents to Companies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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