Activate Change Management on POs Through X++
I had a requirement to update a field on a Purchase Order (PO) during the confirmation process. To make this change, I temporarily set Change Management to "No". After updating the field, I attempted to set ChangeRequestRequired
back to "Yes".
However, I encountered the following error:
"Changes to the document are only allowed in the state Draft, because change management is activated."
The error occurs on the second update()
call because the system considers Change Management as already enabled, even though the flag hasn’t been persisted to the database yet. As a result, the update is blocked due to the PO no longer being in the Draft state.
using (var purchTableSkipBusinessLogicContext = PurchTableSkipBusinessLogicContext::construct())
{
purchTableSkipBusinessLogicContext.parmSkipUpdate(true);
purchTableSelected.CE_ApplyAttachment = NoYes::No;
purchTableSelected.update();
}
Comments
Post a Comment