How to unengineer a job using a BPM?

This is a slightly less detailed version of @jtownsend approach.

//This code assumes you already know the job is engineered and released.

string job = "271562-1-1";

CallService<Erp.Contracts.JobEntrySvcContract>(je =>
{//Modified from John Townsend's approach
    
    //Get full Job Entry Tableset
    var jeTS_Full = je.GetByID(job);
    
    //Grab just the JobHead Row
    var rowFromFull = jeTS_Full.JobHead.FirstOrDefault();
    
    //Create a new EMPTY Job Entry Tableset
    var jeTS = new Erp.Tablesets.JobEntryTableset();
    
    //Create a new JobHead Row
    var newRow = new Erp.Tablesets.JobHeadRow();
    
    //Copy the row from the full tableset.
    BufferCopy.Copy(rowFromFull, newRow);
    
    //Mark the job not engineered. 
    newRow.JobEngineered = false;
    newRow.RowMod = "U"; //<--- Mark updated
    
    //Add to new JobEntry Tableset
    jeTS.JobHead.Add(newRow);
    
    //Unengineer... This will unrelease as well.
    je.ChangeJobHeadJobEngineered(ref jeTS);
    je.Update(ref jeTS);



    //Make changes
    newRow.PartDescription = "That's some bad hat Harry.";


    
    //Re-Release... This will also mark it as engineered.
    newRow.JobReleased = true;
    newRow.RowMod = "U";

    je.ChangeJobHeadJobReleased(ref jeTS);
    je.Update(ref jeTS);

});
2 Likes

Not quite sure if that was a question to Hari or me. If to me, our use case wouldn’t break our rules for what we would consider a change needing documentation. The system design here seems to be a very large catch all that is not very forgiving. Our update met our needs and didn’t have any unintended side affects that we found after pretty extensive testing.

If you have useful ideas to help solve this problem, I’m sure we’re all very willing to hear them.

I have deployed this code but unfortunately it is not working and updating the job as un-engineer.

You may need to hire a programmer to do this for you.