Enable Customization Fields When Document is Completed

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)

Leave a Reply

Your email address will not be published. Required fields are marked *