Unable to use a script include as a search filter

leena5
Giga Contributor

I am on Kingston. I started out with the intention of using a script include to filter for a array of ticket sys_id's. However, I'm testing out using a very simple script (literally just returning a single string which is an existing sys_id, at this point) and I'm not able to get a search or report to filter by what the script returns:

The script include:

The Script Include ReturnSysIds has a function called getmysysids() that simply returns a static string. The string is a sys_id of an existing TASK in my environment. The script include is in the Global application, is Active and is Client callable.

find_real_file.png

 

The search:

I have tried to use this script include in a search filter in the task table with javascript:getmysysids() in the filter. Upon clicking "run", no search results are returned, and I can see the filter has evaluated to NULL. I experience similar behaviour if I try to use the script include in a report instead of a search.

find_real_file.png

And just to confirm that that sys_id does exist:

find_real_file.png

Other things I tried:

  • Using the IS condition for the sys_id filter (instead of IS ONE OF)
  • Setting javascript:new ReturnSysIds.getmysysids() as the filter value
  • Trying with and without the semicolon at the end

None of the above has worked. Any help/suggestions would be welcome!

 

1 ACCEPTED SOLUTION

Shubham Kakade
Giga Guru

The Script Include name you have defined is  "ReturnSysIds" and the function is name as "getmysysids()".

It is mandatory to to have your Script Include name and function name should be same.

Mark it as correct/helpful if this helps you.

 

View solution in original post

5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

Make sure your script include name and function name is same.

Regards,

Sachin

Omkar Mone
Mega Sage

hi 

Try setting the value this way :- 

javascript:new ReturnSysIds().getmysysids()

Shubham Kakade
Giga Guru

The Script Include name you have defined is  "ReturnSysIds" and the function is name as "getmysysids()".

It is mandatory to to have your Script Include name and function name should be same.

Mark it as correct/helpful if this helps you.

 

Jay Shah3
Mega Guru

This post helped me. I was keeping the function name same as script name but it was not working.

On seeing screenshot here I realize that I should mark "Client Callable" true. This thing worked for me.