<< Click to Display Table of Contents >> Enable blocked scheduled jobs |
To enable a blocked scheduled job, you should use the CHelper function called EnableWaitJob. This function takes the id of the scheduled job you wish to enable as a parameter.
CHelper.EnableWaitJob(int idWaitJob)
The following attributes is needed:
•idWaitJob: id of the blocked scheduled job you want to enable.
In this example, the function enableWaitJob will be used to enable a blocked scheduled job.
The expression would be as follows:
The code of the image is as follows:
var dtWaitJobs = CHelper.GetAllStuckWaitJobs();
for(var i=0; i < dtWaitJobs.Rows.Count; i++)
{
var idJob = dtWaitJobs.Rows[i]["idJob"];
var jobName = dtWaitJobs.Rows[i]["jobName"];
var jobDescription = dtWaitJobs.Rows[i]["jobDescription"];
var jobType = dtWaitJobs.Rows[i]["jobType"];
var jobCreationDate = dtWaitJobs.Rows[i]["jobCreationDate"];
var jobEnabled = dtWaitJobs.Rows[i]["jobEnabled"];
var idCreatorUser = dtWaitJobs.Rows[i]["idCreatorUser"];
var idWorkItem = dtWaitJobs.Rows[i]["idWorkItem"];
var DELETED = dtWaitJobs.Rows[i]["DELETED"];
var jobProcessing = dtWaitJobs.Rows[i]["jobProcessing"];
var idTask = dtWaitJobs.Rows[i]["idTask"];
var tskDisplayName = dtWaitJobs.Rows[i]["tskDisplayName"];
var idWFClass = dtWaitJobs.Rows[i]["idWFClass"];
var wfClsDisplayName = dtWaitJobs.Rows[i]["wfClsDisplayName"];
var lastErrorMessage = dtWaitJobs.Rows[i]["lastErrorMessage"];
var countOfTheAttempts = dtWaitJobs.Rows[i]["countOfTheAttempts"];
var radNumber = dtWaitJobs.Rows[i]["radNumber"];
if (idCreatorUser == 1)
{
CHelper.EnableWaitJob(idJob);
}
if (jobCreationDate.AddDays(5) >= DateTime.Now)
{
CHelper.EnableWaitJob(idJob);
}
}
Last Updated 5/23/2024 3:05:40 PM