How to call a global script include from now-sdk?

anthonydian
Tera Contributor

 Hi now-sdk community,

 

I struggle to complete the following task: calling a global script include from my now-sdk scopped application.

 

When the following snippet runs well in a bg script (executed from my application scope): 

var test = new global.inboundAPILog().insertEventLog('x_frt_orangetmf697.inbound.api.event', null, "","");

The exact same script deployed through now-sdk will produce this error: "undefined is not a function".

Surprisingly, if I open the deployed sys_module in my browser, the global script include is well found, and I can navigate to it with control+click : 

anthonydian_0-1753796827515.png

I haven't found any resources on this specific topic, does this speak to you?

 

Thanks a lot for your feedback,

Regards,

Anthony



6 REPLIES 6

GlideFather
Tera Patron

Hi @anthonydian,

 

please re-attach your screenshot using the clip icon, this is not visible due to the forum moderation (not your fault) so nobody can see it...

Debugging tips:

  • check your script include is client callable: true

KamilT_0-1753798509990.png

  • check your custom app has not restricted access

Keep me updated on your progress

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


anthonydian
Tera Contributor

Hello @GlideFather 

Here you go 🙂 

The "client_callable" checkbox was unticked, i just tested it and no luck, still getting the "undefined is not a function." error.
What surprises me is that the exact same code is working through background-script: this should exclude permissions issues from my point of view.

Thanks for your help!

Regards,
Anthony

@anthonydian 

OK, thanks for checking this and what about the accessibility? 

KamilT_0-1753799899515.png

You said it was custom scope...

 

And for the background script, what scope have you there?

KamilT_1-1753800003527.png

 

 

Also, calling global script include with the global in front of the name and function can be troublematic... if nothing else helps, you can try to remove "global." from "global.inboundAPILog()". But just guessing... it might be related to BRs only >>> KB0777628

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Chaitanya ILCR
Kilo Patron

Hi @anthonydian ,

is the script include inboundAPILog accessible from all application scopes? if not please make it public

 

if this doesn't work please share the script includes screenshots and code 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya