Regarding Reference fields

Sanket Choughul
Tera Contributor

I have a couple of Reference Fields.If I click on the look up icon I want the data to be populated depending on some filters or query..and every user can see data depending on his category.

Ex.The caller field must show the data as per the logged in users department.
This must work on impersonation too.
Can I achieve this using OOB Functionality or can someone provide me how to do that.
1 ACCEPTED SOLUTION

Gaurav Shirsat
Mega Sage

Reference Qualifier: - Reference Qualifiers are   to create filters that restrict the data that is returned for a reference field. A reference field stores a link (reference) to a field on another table, making the records/fields in the referenced table available to the form containing the reference field.

How to Reach Reference Qualifier: - Open any Table of Your Choice: - Incident/Problem/Change.

Step 1:-Application Navigator>Incident>Open Existing Record or Create New.

Step 2:-Right Click on Any Reference Field i.e. Caller, Service, and Configuration Item.

Step 3:-Configure Dictionary.

change the simple to dynamic in your case.

Dynamic Reference Qualifier:-Dynamic reference qualifiers enable you to use a dynamic filter option to run a query against a reference field to filter the returned data set.

call this script include into your dynamic reference qualifier.perform this activity for each field of your choice.

department:function()

{

var gr=new GlideRecord('sys_user');

gr.addQuery('sys_id',gs.getUserID());

gr.query();

if(gr.next()){

return "department"+"="+gr.department.toString();  }

},

refer the video 

https://www.youtube.com/watch?v=6V1Vf-pk1wc&t=605s

Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

View solution in original post

8 REPLIES 8

Harish Vaibhare
Kilo Guru

Hi Sanket Choughule

Try these in the Default value field for the Variables:

javascript:gs.getUser().getRecord().getValue('department');//actual name

 

Kindly Mark helpful and correct if it works.

Thanks.

Hitoshi Ozawa
Giga Sage
Giga Sage

ServiceNow supports contextual ACL.  You can set up ACL depending on user's role.

https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/contextual-securi...

Gaurav Shirsat
Mega Sage

Reference Qualifier: - Reference Qualifiers are   to create filters that restrict the data that is returned for a reference field. A reference field stores a link (reference) to a field on another table, making the records/fields in the referenced table available to the form containing the reference field.

How to Reach Reference Qualifier: - Open any Table of Your Choice: - Incident/Problem/Change.

Step 1:-Application Navigator>Incident>Open Existing Record or Create New.

Step 2:-Right Click on Any Reference Field i.e. Caller, Service, and Configuration Item.

Step 3:-Configure Dictionary.

change the simple to dynamic in your case.

Dynamic Reference Qualifier:-Dynamic reference qualifiers enable you to use a dynamic filter option to run a query against a reference field to filter the returned data set.

call this script include into your dynamic reference qualifier.perform this activity for each field of your choice.

department:function()

{

var gr=new GlideRecord('sys_user');

gr.addQuery('sys_id',gs.getUserID());

gr.query();

if(gr.next()){

return "department"+"="+gr.department.toString();  }

},

refer the video 

https://www.youtube.com/watch?v=6V1Vf-pk1wc&t=605s

Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

Sanket Choughul
Tera Contributor

Thanks everyone for help!!