Try our conversational search powered by Generative AI!

Scheduled Jobs


Some question about scheduled jobs:

1. Is it possible to trigger scheduled job from code (programatically)?

2. Is it possible to track whether specific job is running at the moment.

Mar 21, 2014 14:34

1) You can trigger your job by following code (you need to obtain job Id for that - see point 2):

ScheduledJob jobInstance;
if (job.InstanceId != Guid.Empty)
    jobInstance = ScheduledJob.Load(job.InstanceId);
    jobInstance = new ScheduledJob
                              IntervalType = ScheduledIntervalType.Days,
                              IsEnabled = false,
                              Name = job.Name,
                              MethodName = "Execute",
                              TypeName = job.TypeName,
                              AssemblyName = job.AssemblyName,
                              IsStaticMethod = true

    if (jobInstance.NextExecution == DateTime.MinValue)
        jobInstance.NextExecution = DateTime.Today;


if (jobInstance != null)



2) For checking whether job is running - you have to get job Id somehow.

var isRunning = EPiServer.DataAbstraction.ScheduledJob.IsJobRunning(job.ID);


To get job id you need to know type and probably assembly as well (to avoid collisions):

var job = ScheduledJob.List().FirstOrDefault(j => j.TypeName == typeof(YourJobTypeName) && j.AssemblyName == "YourAssemblyName");


Mar 21, 2014 15:25

You have to create new ScheduledJob instances for `jobs` (or actually `plugins`) that has not been executed yet - therefore -> there is no job instance generated for those ones.

Mar 21, 2014 17:45

You can check some sample code here:

Mar 21, 2014 17:45
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.