Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Script Include is not defined

pverni
Tera Contributor

Hello,

 

I'm trying to call a script include "GRCAssessmentUtils" (OOTB) from a BR, but I'm receiving this log message: 

 

com.glide.script.RhinoEcmaError: "GRCAssessmentUtils" is not defined.
sys_script.18cab9d7c3bcb210995c98fdd4013165.script : Line(11) column(0)
8: grAssessment.query();
9:
10: if (grAssessment.next()) {
==> 11: new GRCAssessmentUtils().evaluateAssessmentResult(grAssessment);
12: } else {
13: gs.info('Nenhum assessment finalizado encontrado para o controle: ' + current.sys_id);
14: }
Stack trace:
at sys_script.18cab9d7c3bcb210995c98fdd4013165.script:11 (executeRule)
at sys_script.18cab9d7c3bcb210995c98fdd4013165.script:15
at sys_ui_action.55b4f5c7c3b83210995c98fdd4013165.script:2

 

I tried to create a new and simple script include to test in the backgroud script and receive the same "is not defined." message.

 

Can anyone help me to execute script includes?

2 ACCEPTED SOLUTIONS

Community Alums
Not applicable

Hello @pverni,

The error indicates that the Script Include isn’t being recognized in your current scope. Since GRCAssessmentUtils is part of the sn_grc scoped application, you need to reference it using the full scoped name.

Try initializing it like this instead:

new sn_grc.GRCAssessmentUtils().evaluateAssessmentResult(grAssessment);

 

Also, make sure your Business Rule runs in the same scope or has “Accessible from: All application scopes” set in the Script Include definition.

This should resolve the is not defined error when calling the OOTB Script Include.

If my response helped, please mark it as the accepted solution so others can benefit as well.   

View solution in original post

Brad Bowman
Kilo Patron
Kilo Patron

If the Business Rule is not also in the GRC: Profiles scope, use the full API Name in the call

 

new sn_grc.GRCAssessmentUtils().evaluateAssessmentResult(grAssessment);

 

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@pverni 

that script include extends OOTB Script Include "GRCAssessmentUtilsBase"

you can call the GRCAssessmentUtilsBase script include

also ensure if you are calling that outside of the scope of script include use complete API name

new sn_grc.GRCAssessmentUtils.evaluateAssessmentResult(grAssessment);

AnkurBawiskar_0-1761832841426.pngAnkurBawiskar_1-1761832851168.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

Hello @pverni,

The error indicates that the Script Include isn’t being recognized in your current scope. Since GRCAssessmentUtils is part of the sn_grc scoped application, you need to reference it using the full scoped name.

Try initializing it like this instead:

new sn_grc.GRCAssessmentUtils().evaluateAssessmentResult(grAssessment);

 

Also, make sure your Business Rule runs in the same scope or has “Accessible from: All application scopes” set in the Script Include definition.

This should resolve the is not defined error when calling the OOTB Script Include.

If my response helped, please mark it as the accepted solution so others can benefit as well.   

Thanks for your help!

 

It's working!

Brad Bowman
Kilo Patron
Kilo Patron

If the Business Rule is not also in the GRC: Profiles scope, use the full API Name in the call

 

new sn_grc.GRCAssessmentUtils().evaluateAssessmentResult(grAssessment);