Same Code different behavior Client vs Server 10.1.500.8

Well, I tried it and no, it still did not care. I solved some of my BO errors, but not the final update. instead I used UpdateExt… Then, it would allow me to delete the record. This was likely the ugliest code/logic I have ever written (there is a lot more in the rest of the requirement and not below) and it still isn’t 100%…

  this.CallService<Erp.Contracts.JobEntrySvcContract>(hJob =>{
    Erp.Tablesets.JobHeadRow row = new Erp.Tablesets.JobHeadRow(){
      Company = CompanyID,
      JobNum = oldJobNum,
      PartNum = callContextBpmData.Character03,
      Plant = callContextClient.CurrentPlant,
      JobEngineered = false,
      ChangeDescription = "Rename Job to: " + newJobNum,
    };
    dsOldJobExt.JobHead.Add(row);
    dsErrors = hJob.UpdateExt(ref dsOldJobExt, true, true, out errorsOccured);
    
   
    dsOldJob = hJob.GetByID("oldJobNum");
    dsOldJob.JobProd[0].RowMod = "D";
    hJob.Update(ref dsOldJob);
    hJob.DeleteByID(oldJobNum);
  });

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 :crown: 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);
    }
}
1 Like