I’ve been struggling with this exact same issue to try and automate the closing of maintenance jobs upon the completion of the final op. Except I couldn’t even get a direct call to JobEntry.UpdateExt to work. So I tried my go-to (read: “overly abused”) method of routing things through DynamicQuery and it worked.
The UBAQ this calls also updates via JobEntry.UpdateExt. So I remain at a loss as to how/why this works when all other, better methods failed. However, I’m also at the point were I don’t care either. At the very least, I think I take the for “ugliest solution”.
using (var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.DynamicQuerySvcContract>(Db))
{
var paramRow = new ExecutionParameterRow();
paramRow.ParameterID = "JobNum";
paramRow.ParameterValue = ttLaborDtl[0].JobNum;
paramRow.ValueType = "nvarchar";
qeds.Tables[1].Add(paramRow);
baqds = svc.ExecuteByID("mnt", qeds);
if (baqds.Tables["Results"].Rows.Count > 0)
{
var resultRow = baqds.Tables["Results"].Rows[0];
resultRow["JobHead_JobClosed"] = true;
resultRow["JobHead_ResTopicID1"] = "PASS";
resultRow["JobHead_CommentText"] =
"Automatically closed by " + callContextClient.CurrentUserId;
svc.UpdateByID("mnt", baqds);
}
}