Release a Job by BPM on Updatable BAQ

Hi,

I am trying to release a Job from an updatable BAQ but I always get an error: “Change Description is required”
I need to modify a JOB from a BAQ Updateable and that when saving it is marked as released

I had used some BO Methods but none works well.

foreach (var ttResultsRow in ttResults.Where(row=> row.Unchanged()))
{
  var JobHead = Db.JobHead.Where(row=> row.Company == CompanyID && row.JobNum == ttResultsRow.JobHead_JobNum).FirstOrDefault();
  if (JobHead != null)
  {
    JobHead.JobNum = ttResultsRow.JobHead_JobNum;
  }
  
   var JobSvc = Ice.Assemblies.ServiceRenderer.GetService < Erp.Contracts.JobEntrySvcContract > (Db);
            Erp.Tablesets.JobEntryTableset JobData = new Erp.Tablesets.JobEntryTableset ();
            JobSvc.GetNewJobAudit (ref JobData, JobHead.JobNum, BpmFunc.Now()); 
            JobData.JobAudit[0].ChangeDescription="Test";
            JobData.JobAudit[0].ChangeTime= 22222;
            JobSvc.ChangeJobHeadJobEngineered (ref JobData);
            JobData.JobHead[0].JobEngineered=true;
            JobData.JobHead[0].JobReleased=true;
            JobData.JobHead[0].ChangeDescription="Test";
            JobSvc.Update (ref JobData);
}

Thanks

Hi Saul,

There’s a checkbox in company configuration called prevent changes on engineered jobs. Have you considered unchecking this to see if your updateable query works then?

Nancy

1 Like

Hi Nancy,

I can’t uncheck it because that is a condition of the company.
I removed the check to test and the error continues

Thanks
Saul

Hi Saul,
Did you ever get this to work? I’m running into the same issue.
Thanks!
Lisa

@LMMoser here is mine that works. I had to add the ValidateJobDuomAttributes to get it to happen in my version.

EDIT: To @Nancy_Hoyt’s point I do not have Prevent Changes or Create Audit Log set. I can try that in test to see if it fails.

Ice.Diagnostics.Log.WriteEntry("In Release Job " + jobNum.ToString());
     
     Erp.Tablesets.JobEntryTableset ds = new Erp.Tablesets.JobEntryTableset();

     ds = job.GetByID(jobNum);
      
    // ds.JobHead[0].JobEngineered = true ;
    // ds.JobHead[0].JobReleased = true ;
    
    job.ValidateJobDuomAttributes("JobReleased", jobNum, true, true);
  
     ds.JobHead[0].JobReleased = true ;
     ds.JobHead[0].RowMod = "U";
     
     job.ChangeJobHeadJobReleased(ref ds);
     job.Update(ref ds);
    
     ttr.JobHead_JobReleased = true ;

@gpayne beat me to it :slight_smile:

Calling wrong BO.

JobEntry.ChangeJobHeadJobReleased

I am having similar challenges. All I need is to close the job and put some comments on the job comment text (maintenance jobs). Has anyone been successful closing maintenance jobs on updatable BAQ?