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

Is this bound for the Application Store?

If so, you can't use the Global Script Include workaround mentioned, as that cannot be packaged as part of your application.

Is there scope to get the existing Data Policies converted to UI Policies?


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