Script include for advanced reference qualifier

petterbj_rgmo
Tera Contributor

Hello experts

I am facing a issue with a script include I am using in for a advanced reference qualifier. The customer I am working with is using the Service Desk Call application. If they the Call type is set to incident, they should be able to choose a service, a category and a subcategory. Currently I have a reference field (Category and Subcategory) that is doing a lookup on the sys_choice table. In the script include I have added a query to get all the relevante categories and returning them, but the reference field is not populated. Pictures to follow:

Script include:
find_real_file.png

Catefory reference specification:

find_real_file.png

Category field specification:

find_real_file.png

Can anyone assist me in finding my error? Do I have to return something else than the label?

1 ACCEPTED SOLUTION

Geoffrey2
ServiceNow Employee
ServiceNow Employee

Your script might be stopping when it hits the undefined 'current' on line 11.   Try passing current as another argument when you call your function.



This is how I would define the Script Include.   Then call it with javascript: new GSS_Call_Categories().getRefQual(current)



Capture.PNG


View solution in original post

15 REPLIES 15

tanumoy
Tera Guru

I think the reference qualifier should be like:



javascript:new myScriptInclude().my_function()



In your case it will be:



javascript:new GSS_Call_Categories().GSS_Call_Categories()


I added your change, so now it is like this:
find_real_file.png



Now it is returning all categories no matter what service is set.




find_real_file.png


Ok, now could you please change your script include a little bit:



Replace the line   function GSS_Call_Categories(internal_service_sys_id) with the following lines:



var GSS_Call_Categories = Class.create();


GSS_Call_Categories.prototype = {


  initialize: function() {


  },




  GSS_Call_Categories:function(internal_service_sys_id) {



Put required } in the end.


Did some changes and now it looks like this:
find_real_file.png



Was this what you were thinking?