Search code examples
workflowacumaticaquote

Acumatica how to modify opportunity stageid Even if quote is accepted


The standard behavior is to disable modifications of some opportunity Fields when quote is not on hold. I don’t find in source code where is this rule and don’t know how to change this behavior.


Solution

  • Try this workflow extension, you may need to compile it into a DLL.

    using PX.Data;
    using PX.Data.WorkflowAPI;
    using PX.Objects.CR;
    using PX.Objects.CR.Workflows;
    
    namespace Customization;
    
    public class OpportunityWorkflowExt : 
        PXGraphExtension<OpportunityWorkflow, OpportunityMaint>
    {
        public override void Configure(PXScreenConfiguration config)
        {
            var context = config.GetScreenConfigurationContext<OpportunityMaint, CROpportunity>();
    
            context.UpdateScreenConfigurationFor(screen =>
                screen
                    .UpdateDefaultFlow(flows =>
                        flows.WithFlowStates(flowStates =>
                        {
                            flowStates.Update<OpportunityStatus.won>(state =>
                                state.WithFieldStates(fs =>
                                    fs.AddField<CROpportunity.stageID>()));
                            flowStates.Update<OpportunityStatus.lost>(state =>
                                state.WithFieldStates(fs =>
                                    fs.AddField<CROpportunity.stageID>()));
                        })));
        }
    }