We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Can we call script include from background script.

aagman4
Tera Contributor

Script Include

 

var Test = Class.create();
Test = Object.extendsObject(global.AbstractAjaxProcessor, {

type: 'Test',

 

autoMap: function(current) {

 

}

 

});

 

Background Script

 

var update = new Test();
update.autoMap(current);

 

I am trying this in Background Script but it is not working.

 

Can anyone pls help me on this as I am doing this activity for the first time.

 

Thanks!

 

2 REPLIES 2

shivangi k
Kilo Sage

Hi @aagman4 ,

 

Yes you can call script include in background script:

 

new ScriptIncludeName().functionName();

 

Please mark helpful if it helped you.

 

Regards,

 

Hi @aagman4 

 

If you are passing and current value in function then use:

 

var gr= new GlideRecord("table name");

var ga=gr.getValue('field name whose value required');

new ScriptIncludeName().functionName(ga);

 

Please mark helpful if it helped you.

Regards,