: com.glide.script.fencing.MethodNotAllowedException: Function setUseEngines is not a allowed in scope xx

Meenal Gharat
Giga Guru

Hello expert,

we are receiving the below Errors seems setUseEngines is not accessible in scope xx

Evaluator.evaluateString() problem: com.glide.script.fencing.MethodNotAllowedException: Function setUseEngines is not allowed in scope xx

Is there any replacement for this or any suggestions?

Thanks in advance!

Meenal

11 REPLIES 11

Hi paul,

this business rule is used to Prevent Discovery set FQDN on Hostname

var hn = current.host_name.toString();
var cn = hn.split('.');
var nm = cn[0];

if(hn.contains('.')){
if(isNaN(nm) == true){
current.host_name = nm;
current.setUseEngines(false);
current.setWorkflow(false);
current.update();
}
}

Hi,

Create a SI in global scope and put this code there and then in the BR you can call

new global.your_si_name().your_function();//current will be available in your SI so your code can work as is in SI.

Kindly mark the comment as a correct answer if this has solved your problem.

Hi asifnoor,

Similarly we are using setUseEngine scripted REST API. where SetUseEngine is used to avoid Duplicate SLA. Can we do the same for this as well ?

 

below is our code.

 

var body = request.body.data;

gs.info("[Add Note To Incident] Processing message: {alias=" + body.alias + ", note=" + body.workNotes + "}");

var alertAlias = body.alias;
var note = body.workNotes;

var inc = new GlideRecord('incident');

inc.addQuery("x_alert_alias", alertAlias);
inc.addQuery('state','!=', 6);
inc.addQuery('state','!=', 7);
inc.addQuery('state','!=', 8);
inc.query();

if (inc.next()) {
inc.work_notes = note;

inc.setUseEngines(false);//Added to stop SLA Duplicate issue
inc.update();
gs.info("[Add Note To Incident] Processing finished.");
} else {
gs.error('[Add Note To Incident] Unable to find incident with x_alert_alias : ' + alertAlias);
}

 

kindly suggest.

Thanks, 

Meenal

It makes sense for that API to be disallowed in an application scope.

What is the reason for doing this in an application scope? Perhaps it would be more appropriate in Global?


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi paul,

This is integration between SNOW and Third party that's the reason it is in Scoped Application.

Thanks and Regards,

Meenal