Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Execute SI within condition builder in a report/visualization source

NeoOndaro
Tera Contributor

I've created a script include

NeoOndaro_1-1765557803601.png

 

that I want to call from the condition builder of a report (visualization source)

NeoOndaro_2-1765557833449.png

 

I have validated the query works by putting it in a background script

NeoOndaro_0-1765557777357.png

Yet when I try to execute it in the condition builder, I get nothing (see second screenshot).
and before you ask, yes The Sandbox sys_property (glide.script.use.sandbox) is set to true

 

What am i doing wrong?

1 ACCEPTED SOLUTION

maheshkhatal
Mega Sage
Mega Sage

@NeoOndaro  can you run this script in background script as var result = new global.ScriptIncludeName(2 ) and gs.info(JSON.stringify(result)); Otherwise I see no problem in your script include calling. You can create one more server side script include and (Make sure Glide AJAX is unchecked). Defined your function inside this script include. 

Try this approach once. 

If my suggestions helped you kindly mark this as helpful.

Thanks,

Mahesh.

 

View solution in original post

2 REPLIES 2

maheshkhatal
Mega Sage
Mega Sage

@NeoOndaro  can you run this script in background script as var result = new global.ScriptIncludeName(2 ) and gs.info(JSON.stringify(result)); Otherwise I see no problem in your script include calling. You can create one more server side script include and (Make sure Glide AJAX is unchecked). Defined your function inside this script include. 

Try this approach once. 

If my suggestions helped you kindly mark this as helpful.

Thanks,

Mahesh.

 

NeoOndaro
Tera Contributor

Thank you Mahesh...second eyes is ALWAYS helpful. Didn't even think about trying to call the SI from a BS which um.. DUUHHH!! Anyway, i was getting 'undefined' errors on the VAR statement which told me something was wrong and it couldn't even access the SI.  I re-created the SI and did it the preferred way with making a function within the SI so I kept the AbstractAjaxProcess. Then called "javascript:new global.AssetUtilPC().usersWithMultiAssets(2 ) and bingo. worked! Thanks for the lead! 

NeoOndaro_0-1765560194903.png