The CreatorCon Call for Content is officially open! Get started here.

How can I apply a Reference Qualifier only when a field is valued a certain way?

Shane J
Tera Guru

My Change Manager would like the 'Parent' field on Change Request (Task table reference) to be limited to Incident and Problem records only when the Type == Emergency, otherwise the entire Task table can be used.   I've got a reference qualifier:

sys_class_name=incident^ORsys_class_name=problem^EQ

But how do I apply it only in that case?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Look at using an advanced reference qualifier (a script of your choosing.) Pass the function your type, it can then return the proper filter string (either the above or nothing.)



javascript:myConditionCheck().changeType(current.type);



var myConditionCheck = Class.create();


myConditionCheck.prototype = {


      initialize: function() {


      },


    changeType : function(changeType) {


            if (changeType == 'Emergency')


                  return 'sys_class_name=incident^ORsys_class_name=problem^EQ';



            return '';


    },



      type: 'myConditionCheck'


};



http://wiki.servicenow.com/index.php?title=Reference_Qualifiers


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Look at using an advanced reference qualifier (a script of your choosing.) Pass the function your type, it can then return the proper filter string (either the above or nothing.)



javascript:myConditionCheck().changeType(current.type);



var myConditionCheck = Class.create();


myConditionCheck.prototype = {


      initialize: function() {


      },


    changeType : function(changeType) {


            if (changeType == 'Emergency')


                  return 'sys_class_name=incident^ORsys_class_name=problem^EQ';



            return '';


    },



      type: 'myConditionCheck'


};



http://wiki.servicenow.com/index.php?title=Reference_Qualifiers


Hi chuck,



      Just a minor correction to the code, the function parameter and the variable you are using inside if are not same.


Thanks. Updated.


Well I'm missing something but I'm not sure what:



find_real_file.png



find_real_file.png



What'd I screw up?