Question

How to force a custom field to remain enabled in SO301000 despite workflow settings


Userlevel 3
Badge

Hi everyone,


In the SO301000 screen, I want one of the customised fields to remain accessible (enabled) for quotes, even when this document has been processed (Completed).
 
I thought I could deal with this by using an event handler implemented in one of our SOOrderEntry graph extensions.
 
public virtual void _(Events.RowSelected<SOOrder> e, PXRowSelected baseMethod) {

    if (!(e.Row is SOOrder soOrder)) return;

    baseMethod?.Invoke(e.Cache, e.Args);

     if(SOBehavior.QT.Equals(soOrder.Behavior))
     {
         PXUIFieldAttribute.SetEnabled<SOOrderExt.myCustomField>(cache, soOrder, true);
     }
}
 
Unfortunately, as you guess, it doesn't work. I suppose it is due to the workflow of this screen that disable all fields of SOOrder table when the status Completed is reached.

           

Is it possible to make my field accessible despite these settings?


4 replies

Userlevel 7
Badge +4

Hi @ygagnaire12,

Yes, you are right. To enable the field in certain status, you will have to enable in the workflow as well(if the screen has one).

So to enable a specific field in a certain status, extend the workflow(in SO screen its based on the Order Type) and enable it(check the Active check box). For Quote, system uses QT workflow,

  

Add the custom field for the Completed State and make sure enable check box isn’t checked,

 

Feel free to post back if you have any questions.! Good Luck,

Badge +11

Yes, it is possible.

I usually modify the workflow in code, but you can do it through the visual workflow editor also. This is a good post on how that can be done. Ignore the fact that it’s specifically about UDFs. The content is applicable.

 

I think you additionally need this code, but I’m not positive. It may depend on which version you are on.

protected virtual void _(Events.RowSelected<SOLine> e, PXRowSelected b)
{
SOLine row = e.Row;
if (row is null) return;

b?.Invoke(e.Cache, e.Args);

// Enable 'Unit Cost' field
Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<SOLine.curyUnitCost>(e.Cache, row, true);
}

(You can make it applicable to your situation, obviously)

Userlevel 7
Badge +9

@ygagnaire12

All comments from @Vignesh Ponnusamy and @darylbowman are valid. I’m thinking since you have the coding on the go already, if you instruct the platform to run your graph ext after all other graphs and extensions are executed you should have the upper hand. To do that instead of solely extending on base graph, include the YourBaseGraph_Workflow and YourBaseGraph_ApprovalWorkflow as well in the order they should be executed something like:

public class MyGraphExt : PXGraphExrension<YourBaseGraph_ApprovalWorkflow, YourBaseGraph_Workflow, YourBaseGraph>{}

Userlevel 3
Badge

Many thanks to all 3 of you ! I check this as soon as possible...

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved