I am trying to update the status of a group of jobs from Released to Complete through an IDO extension class. My thought was that I could use the JobStatusChangeMassSp to do this, but I cannot seem to get it to update. It will return a message that jobs were updated but it is not actually changing the status. I am hoping someone has done this or seems an error in my process:
[IDOMethod(MethodFlags.None)]
public int UpdateJobsToComplete(string min, ref string Infobar)
{
DataTable jobsMeetingAllCriteria = GetJobsMeetingAllCriteria(min, ref Infobar);
if (jobsMeetingAllCriteria.Rows.Count == 0)
{
Infobar = "No jobs found that meet all criteria.";
return 0;
}
int updatedCount = 0;
foreach (DataRow job in jobsMeetingAllCriteria.Rows)
{
string jobNumber = job["Job"].ToString();
string suffix = job["Suffix"].ToString();
try
{
InvokeRequestData tReq = new InvokeRequestData()
{
IDOName = "SLJobs",
MethodName = "JobStatusChangeMassSp",
Parameters = new InvokeParameterList()
{
"C",
"R", // Jobs in Release Status
"From Job Status",
"C", // Jobs moved to Complete Status
"To Job Status",
"1",
jobNumber,
suffix,
jobNumber,
"9999", // ending Suffix value
"", // Assuming empty string is needed
"", // Assuming empty string is needed
"", // Assuming empty string is needed
"", // Assuming empty string is needed
"0",
"0",
"", // Assuming empty string is needed
"", // Assuming empty string is needed
"", // Assuming empty string is needed
"", // Assuming empty string is needed
}
};
InvokeResponseData tResp = Context.Commands.Invoke(tReq);
// Check the response for success
if (tResp.IsReturnValueStdError())
{
Infobar += $"Failed to update job {jobNumber}-{suffix}: {tResp.Parameters[20].Value} ";
}
else
{
updatedCount++;
Infobar += $"Job {jobNumber}-{suffix} and all sub jobs have been changed to Complete. ";
}
}
catch (Exception ex)
{
Infobar += $"Failed to update job {jobNumber}-{suffix}: {ex.Message} ";
}
}
// If all jobs are updated
if (updatedCount == jobsMeetingAllCriteria.Rows.Count)
{
Infobar += "All jobs have been updated to Complete.";
}
else
{
Infobar += $"{updatedCount} jobs have been successfully updated to Complete.";
}
return updatedCount;
}