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.

Access to Script Include 'global.CEP_Client' blocked from scope: x_1393966_a_a_no_0

PhFranca
Tera Expert

Hello guys!

For a few days now I've been trying alone to overcome the error "Access to Script Include global.CEP_Client blocked from scope: x_1393966_a_a_no_0" and I still haven't succeeded. 

In the record procuder, I am entering a ZIPCODE and trying to return data such as street name, neighborhood, state, city. But the mentioned error occurs.


Record producer.
erro-record-producer.png

I'm a beginner and this solution is part of my learning process. I've changed several things, redone all the work, read the documentation and I'm doing something wrong that I don't realize what it is. Please, can you give details, including if the code is wrong or missing something?

Catalog Cliente Scripts
onChange.png
Script Include
script-include.png

Can anyone help me?
Thanks in advance!

Phlavio

1 ACCEPTED SOLUTION

Allen Andreas
Tera Patron

Hello,

Your CEP_Client script include isn't in the global scope? It's part of your custom application (look at your application field in second screenshot)? See the API name in your second screenshot? You'd want to use that, instead.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Allen Andreas
Tera Patron

Hello,

Your CEP_Client script include isn't in the global scope? It's part of your custom application (look at your application field in second screenshot)? See the API name in your second screenshot? You'd want to use that, instead.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hello, @Allen Andreas!

No, it is not in the global scope. Yes, it is part of my custom application. I set the Accessible from field to: all application scopes.

then, in Catalog Client Scripts Auto complete CEP onChange, in line 6, I should use?

 

 

var ga = new GlideAjax(x_1393966_a_a_no_.0.CEP_Client');

 

 

 If so, I've already done it and it gives a similar error.

Phlavio

PhFranca
Tera Expert

@Allen Andreas 

I did the update as shown below:

Script Include
script-include.global.png

Catalog Cliente Scripts
onChange-myapp.png

I am not getting the error mentioned above.
But the fields are not filling automatically. Please, can you guide me?
fieldempty.png

Phlavio


Hi @PhFranca 

I'm glad my initial reply above guided you correctly to solve the issue this post was about. If you don't mind, please mark it as "Accept Solution" since that was your question and my reply answers that.

 

For additional assistance that goes beyond the question you initially asked, I don't believe you needed to add global to your script include. I'm unsure where you're getting that you think you need to do that, but please refrain from adding the "global" word to your API or to the script include. If you're wanting this script include to be accessible from other scopes (so available in global to other apps, etc.) then you would set the "Accessible from" field on the script include to be available to all scopes, which it already is, so you can halt using "global" and placing that within your scripts.

 

As far as the rest, you'd need to consider using logging and check your script include that it is in fact being called, see what your values are, and see what you're returning to your client script. Then, in the client script, consider using console or alerts to see what you're getting from the script include. All of this should be verified before you try to set field values. As an additional resource, here is a GlideAjax cheat sheet I commonly refer people to. Please check this and validate it aligns with what you're trying to do.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!