Using script includes in sysparm_fixed_query

lzeke
Giga Contributor

Is this possible? Can anyone point my to an example?

I assume the script include needs to be client callable and I would need to call this through GlideAjax, but I would need to set the function name, the parameters, etc., while it seems that only thing I can do in a sysparm_fixed_query is to specify an expression.

Thanks a lot!

1 ACCEPTED SOLUTION

lzeke
Giga Contributor

Actually, I made it work in both environments: there was nothing wrong with the code, the problem was with the


sysparm_fixed_query - the type of the field was a Reference, not a String, and my test function was returning a string. This - somehow - caused SN to abort the the method call.




Thanks for your help, Cory!


View solution in original post

7 REPLIES 7

coryseering
ServiceNow Employee
ServiceNow Employee

Hi Laszlo,



The client-callable check box is checked?


Here is a test I just ran on a Eureka build:


Screen Shot 2015-08-22 at 8.56.40 AM.png



Screen Shot 2015-08-22 at 8.57.43 AM.png


This has my test Script Include, as well an example of how it is used the URL and the results it returned.


Thanks, Cory, I copied your code - character by character - same problem. Therefore, I have to conclude that your answer is the correct one (since you experience the expected behavior), but - for whatever reason - our Eureka instance behaves differently. (I will mark your answer correct.) Now, I also tried this on my dev (Fuji) instance and same result: it is not working. So, there is something that we are still missing, but I have no clue what it is.


lzeke
Giga Contributor

Actually, I made it work in both environments: there was nothing wrong with the code, the problem was with the


sysparm_fixed_query - the type of the field was a Reference, not a String, and my test function was returning a string. This - somehow - caused SN to abort the the method call.




Thanks for your help, Cory!