condition using IN operator

Prashant More1
Kilo Contributor

in below argument condition i want to add "^Location in ( gs.getUser().getLocation())"--  user can have multiple Location.please suggest correct syntax

find_real_file.png&sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^company=javascript:gs.getUser().getCompanyID();

1 ACCEPTED SOLUTION

VigneshMC
Mega Sage

&sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^company.sys_idINjavascript:gs.getUser().getCompanyID();

View solution in original post

3 REPLIES 3

Mark Roethof
Tera Patron

Hi there,

You could simulate your encoded queries thru for example:

find_real_file.png

find_real_file.png

This will give you an example query, which will give you the pieces you are after 🙂

 sys_idINa,b

In this case you are after the IN statement I guess.

This one isn't that hard of course. Though building your queries like this could help with more complex things, like date calculations, etc..

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

VigneshMC
Mega Sage

&sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^company.sys_idINjavascript:gs.getUser().getCompanyID();

vkachineni
Mega Sage

//try

&sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^company=javascript:gs.getUser().getCompanyID()^location.sys_idINa,b

 

a and b are the sys_ids of the location

you can have a script include that returns a list of sys_ids of locations

 

&sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^company=javascript:gs.getUser().getCompanyID()^javascript: new GetLocations().getUserLocation();