Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restrict particular records using query business rule.

Pallavi pawar
Tera Contributor

Hi All,

 

How can I restrict HR Task records for "Requested for"  user using query business rule.

 

Thanks!!

2 REPLIES 2

BharathChintala
Mega Sage

@Pallavi pawar write new BR as below. for example I used ritm table you can replace hr task

BharathChintala_0-1677869215347.png

BharathChintala_2-1677869338000.png

Just add this line in advanced

current.addEncodedQuery('requested_forDYNAMIC90d1921e5f510100a9ad2572f2b477fe');
If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

Bert_c1
Kilo Patron

Hi Pallavi,

 

I suggest you look at existing BRs:

https://[instance].service-now.com/sys_script_list.do?sysparm_query=action_query%3Dtrue&sysparm_view...

and specify what table has the field "Requested for". I don't see that on the hr_task table.  An example script follows if you want to restrict the current user to those where the user is "Requested for"

 

 

var me = gs.getUserID();
current.addEncodedQuery("requested_for=" + me);

 

provided the column name is 'requested_for'.