BPM's or DD's that need to update record 'B' on change to record 'A'

I want a field for an OrderDtl record to be updated, when a different OrderDtl record (but for same Company & OrderNum) is changed.

Pretend that OrderQty of line 2 must always be twice the OrderQty of line 1.

If OrderQty of line 1 changes, then I need to set OrderQty of line 2 to 2x line 1’s OrderQty.

And if line 2 changes, then I need to set OrderQty of line 1 to 1/2 of line 2’s OrderQty.

How would you address this? BPM (Pre-Proc or Post-Proc), or DD (In-Trans or Standard)?

And most importanly, how do you make a change to the record that wasn’t changed?

I’m pretty sure you can do with with a Post-Proc Method Directive on Update.

Do all of your conditions then point to a Custom Code Module. Inside might look something like:

using (var txScope = IceContext.CreateDefaultTransactionScope())
{
var OrderDtl_xRow = (from ThisOD in ttOrderDtl where
ThisOD.Company == Session.CompanyID &&
ThisOD.RowMod == IceRow.ROWSTATE_UPDATED
select ThisOD).FirstOrDefault();

  if(OrderDtl_xRow != null)
  {
  	int OL = OrderDtl_xRow.OrderLine + 1;					
  						
  	var OrderDtl_yRow = (from ThisOD in Db.OrderDtl where
  						ThisOD.Company == Session.CompanyID &&
  						ThisOD.OrderNum == OrderDtl_xRow.OrderNum &&
  						ThisOD.OrderLine == OL 
  						select ThisOD).FirstOrDefault();
  						
  	if(OrderDtl_yRow != null)
  	{
  		OrderDtl_yRow.SellingQty = OrderDtl_xRow.SellingQty * 2m;				
  	}
  }
  	Db.Validate();
  	txScope.Complete();

}

If that works, you’ll probably still have to GetByID/Refresh the Order before you see any changed value in the client.