Run scheduled job from script

Snow Tomcal
Tera Expert

Hi, is there any way to run a scheduled job from client/server script?

Thanks in advance 🙂

3 REPLIES 3

Rahul RJ
Giga Sage
Giga Sage

@Snow Tomcal  Yes we can run it from server script or client callable script include 

Please see the  link for trigger a scheduled job from the Business rule 

 

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.

 

Regards,

RJ

 

Basheer
Mega Sage

Hi @Snow Tomcal ,

There are multiple ways through which you can run a scheduled job either from client side or server side.

 

From server side

var scheduledJob= new GlideRecord('sysauto_script');

scheduledJob.newRecord();

scheduledJob.name = current.name;

scheduledJob.active = true;

scheduledJob.run_type = 'once';

scheduledJob.run_start =       current.time;

scheduledJob.script = ''// if you need some script to be running;

 

You can achieve the same via client side as well, you need to use same script in script include and trigger that script include from a client script.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Sagar Pagar
Tera Patron

Hi @Snow Tomcal,

Take a look at article - Execute Scheduled Jobs From Script 

 

Thanks,

Sagar Pagar

The world works with ServiceNow