How to unengineer a job using a BPM?

Does anyone know of a way to unrelease/unengineer a job using a BPM?
I seem to always get the “JobHead not changed” error when trying to run ChangeJobReleased method.

Any help would be useful!

You need 4 widgets to do this in a BPM: JobEntry.GetDatasetForTree, Update Table by Query, JobEntry.ChangeJobHeadJobEngineereed, and JobEntry.Update.

The only tricky part is setting the Update Table by Query. I have attached a BAQ with the BPM in it for example.

teste.baq (48.7 KB)
I have hardcoded this for one job, so you will have to change that filter. Otherwise the BPM part is pretty simple.

Good luck!

3 Likes

This is using a function (which you should be using for anything complicated anyway), but it walks you through the whole process of taking an existing job, unengineering it, re-pulling details, and re-engineering. If you stick to BPM’s, the method calls will be pretty much the same.

Note that this specific example was meant to be run on a list of JobHead records. For your needs you’d need to call JobEntry.GetByID() or use a LINQ query to create the variable “job”.

The quick answer to your question is that JobEntry.Update() does not like having any child rows in the dataset of engineered jobs. You have to strip out everything except the JobHead record.

3 Likes