Hello Everyone,
I would like to share my experience with the Workflow Engine on this requirement, which I recently worked on. Usually, these kinds of tasks are requested by clients/customers to update the customization fields even when the document is completed/closed for reference purposes.
For instance, If we have added a customization field at the Sales Order Line level, and still we wanted to edit/update the customization fields when Sales Order document status is changed to completed to have a field as a reference purpose, we need to perform below activities.
- We need to allow the caches to update in the RowSelected event when Sales Order is Completed status.
- Extend the Workflow from the required base workflow and enable the field at the State Properties tab for the specified status (Completed).
SOLine DAC RowSelected Event Code
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOLine row = e.Row as SOLine;
if (row != null)
{
//Allowing caches to update with below code
Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<SOLineExt.usrCustomField>(cache, row, true);
}
}
}
Workflow Changes at Customization Package
- Add the Sales Order screen to the customization package
- Expand the screen (SO301000) and workflows
- Add a new Workflow by extending the Base Workflow
- Select the newly created Workflow for the Workflow type i.e. SO
- Select the required Sales Order status (i.e. Completed status) and on the right-hand grid add the custom field from the specific DAC and uncheck the Disabled checkbox. i.e. (Sales Order Line à Custom Field à Uncheck the Disabled field)
Hi,
Thanks very much for this, I can now edit a SOLine field where the SO is Completed.. but the Save button remains disabled so the user can’t save their changes.
Do you have any idea how to enable the Save button conditionally?
I have tried adding this code to SOOrder_RowSelected and SOLine_RowSelected, but it has no effect:
cache.AllowUpdate = true;
Base.Transactions.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
Thanks
I managed to resolve the disabled Save button issue by setting this on SOOrder_RowSelected:
Base.Transactions.Cache.AllowUpdate = true;
And I also had to configure the Completed workflow to set Sales Order ‘Base’ deactivated= false
I think Acumatica need to fix this so fields can be activated and the save button enabled, based on state, without having to implement code changes as well.
I have the same problem in 22R2.
Do you know James if there is another solution? Is disabling the workflow okay?
Thanks