How to create a reference qualifier for CI to filter only CIs that assigned to caller.

jesusemelendezm
Mega Guru

Incident Management Form:

How to create a reference qualifier for CI to filter only CIs that assigned to caller.

1 ACCEPTED SOLUTION

Hi Jesus,



You just need to reference current.caller_id in your reference qualifier or- even better- write a Script Include to do it. Here are a few references:



Dynamic Reference Qualifier for KB articles


Reference Qualifiers - ServiceNow Wiki


Use Reference Qualifier to filter Location field



Best practice is to use a Script Include that refers to the "current" record and returns the string for the condition. Soemthing like this:



var ReferenceQualifiersCI = Class.create();  


ReferenceQualifiersCI.prototype = {  


      initialize: function() {  


      },  


 


      forCurrentCaller:function() {  


              var caller = current.caller_id + '';  


 


              //just ones assigned to this caller


              return 'assigned_to=' + caller;  


      },  


 


      type: 'ReferenceQualifiersCI'  


};  



You would then use a javascript: reference qualifier as described earlier:



javascript:new ReferenceQualifiersCI().forCurrentCaller();



That should return a string like:



assigned_to=e7iru4723je38rr721l908fnfr823hd3



Where the sys_id of the caller on the current incident is "e7iru4723je38rr721l908fnfr823hd3".


View solution in original post

20 REPLIES 20

David OBrien
Kilo Guru

You can add a reference qualifier that is Assigned To is 'javascript:gs.getUserID()' in the Dictionary on the Configuration Item field.


refqual.PNG



Since the Configuration Item field sits at the base Task table, you may want to do this as a dictionary override instead that is only for incidents.   Filtering it in the dictionary override you can use: assigned_to=javascript:gs.getUserID();


Thanks for your help David.



javascript:gs.getUserID(); this is the user logged in the system. I am looking to get the value of the caller_id field in the incident form. Basically service desk agent enter caller name, based on the caller name, I want to filter only those CIs that are associated to this caller.


Sorry about that. I misread your question.   For matching the Caller you should be able to use: javascript:'assigned_to=' + current.caller_id;


Hi Jesus,



You just need to reference current.caller_id in your reference qualifier or- even better- write a Script Include to do it. Here are a few references:



Dynamic Reference Qualifier for KB articles


Reference Qualifiers - ServiceNow Wiki


Use Reference Qualifier to filter Location field



Best practice is to use a Script Include that refers to the "current" record and returns the string for the condition. Soemthing like this:



var ReferenceQualifiersCI = Class.create();  


ReferenceQualifiersCI.prototype = {  


      initialize: function() {  


      },  


 


      forCurrentCaller:function() {  


              var caller = current.caller_id + '';  


 


              //just ones assigned to this caller


              return 'assigned_to=' + caller;  


      },  


 


      type: 'ReferenceQualifiersCI'  


};  



You would then use a javascript: reference qualifier as described earlier:



javascript:new ReferenceQualifiersCI().forCurrentCaller();



That should return a string like:



assigned_to=e7iru4723je38rr721l908fnfr823hd3



Where the sys_id of the caller on the current incident is "e7iru4723je38rr721l908fnfr823hd3".