Custom code bpm

I am creating a bpm in the method Erp.QuickJobEntry.ChangeQuickJobReleased. The table in the method is ds.QuickJob(ttQuickJob). I need to set a directive that has the condition:

If ttQuickJob.Released is changed from false to true then set JobHead.Date01 field to now().

Jobhead.Date01 is not an option is this method so I need custom code to grab that table and field.


You can easily have a condition variable check your released bit and executing custom code on the true condition.

Tim has posted before on how to properly update another table, using a new transaction scope and proper LockHints.

using(var txScope = IceContext.CreateDefaultTransactionScope()) {
        var order = Db.OrderHed.With(LockHint.UpdLock).Where(o => o.Company == Session.CompanyID && o.OrderNum == orderNum).FirstOrDefault();
        order.DecorType_c = quote.DecorType_c;
        order.BldgType_c = quote.BldgType_c;

Of course, this just needs a few changes like the table and which fields you need to update.

You should be able to do that in a Preprocessing directive, just put a condition in for if JobReleased is changed from false to true, then have a set field that sets the Date01 field to the current date. No custom coding needed