I’ve created a UD field for POHeader, but when the Purchase order is approved the field can’t be changed by the user or by customization code.
I’ve noticed that the PrintAs field can be changed regardless of approval status. Is there a way to set up the UD field to have the same saving behavior?
Just put your variable in for the PO Num and change the name of the UD field.
CAUTION!! This writes directly to the DB bypassing any BO logic. It’s practically like using SQL to modify the DB. A misconfigured expression might cause multiple records to update. You should only do this as a last resort.
And because the UI will disable that field, you’ll probably need to make an updateable dashboard or some other way to allow the user to enter the new value, that the BPM will use.
You might be able to set the ReadOnly or Enabled property of UD fields control. Or it might have to happen at the dataview level.
Then use an onchange event of that control. First check if the PO is approved, if not, then do nothing and let the normal flow happen for updating the DB. If the PO is approved, then execute the custom code. But with a new value in that field, it will try to update and fail, which might give users an odd error message or warning. Maybe you’ll have to look into refreshing the dataview after the DB write, so that leaving the PO doesn’t look like any changes were made.