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.

javascript:getMyGroups() not working in business rule

dhathri1
Giga Contributor

Hi All,

current.addQuery('assignment_group','javascript:getMyGroups()'); is not working, Please let me know what is exactly wrong in this.

14 REPLIES 14

I tried using only 'gs.getMyGroups()' but it is showing all the records, not working as intended


Have you tried replacing the statement



  current.addQuery('assignment_group','javascript:getMyGroups()');


with


  current.addQuery('assignment_group','IN', getMyGroups());


I tried, this is also not working


rob_pastore
ServiceNow Employee

What are you trying to do?   Is this in the incident query business rule?


If this is a before business rule meant to filter out the records, I don't believe you can just say:



current.addQuery('assignment_group','javascript:getMyGroups()');




This isn't actually doing anything.  




You need to associate these values to the var qc




  var qc = current.addQuery("caller_id", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u);




also, if the code you added is only supposed to run for itil users, i would put all of the code in the 'else' section of the if at the bottom. No need to run the risk of running both sets of code.