Solved

i want to Override Action@Open at CRCaseMaint_Extension

  • 10 August 2023
  • 1 reply
  • 79 views

public delegate IEnumerable OpenDelegate(PXAdapter adapter);
        [PXOverride]
        public IEnumerable Open(PXAdapter adapter, OpenDelegate baseMethod)
        {
            //    baseMethod(adapter);
            //string orderNbr = Base.Transactions.Current.SOOrderNbr;


                return adapter.Get();

            }


        }

 

error

Method System.Collections.IEnumerable Open(PX.Data.PXAdapter, OpenDelegate) in graph extension is marked as [PXOverride], but the original method with such name has not been found in PXGraph
The customization project must be published before the screen can be edited.

icon

Best answer by darylbowman 10 August 2023, 12:26

View original

1 reply

Badge +11

If you inspect the CRCaseMaint source code, you won’t find an Open method. The Open action actually comes from CaseWorkflow, an extension of CRCaseMaint, which handles the workflow function. Additionally, the Open action is not a graph action, but rather a workflow action. Here’s where it’s defined:

var actionOpen = context.ActionDefinitions.CreateNew(ActionNames.Open, a => a
.WithFieldAssignments(fields =>
{
fields.Add<CRCase.isActive>(f => f.SetFromValue(true));
fields.Add<CRCase.resolution>(f => f.SetFromFormField(formOpen, _fieldReason));
fields.Add<CRCase.ownerID>(f => f.SetFromFormField(formOpen, _fieldOwner));
fields.Add<CRCase.resolutionDate>(f => f.SetFromValue(null));
})
.DisplayName("Open")
.WithCategory(categoryProcessing)
.MapEnableToUpdate()
.WithForm(formOpen)
.WithPersistOptions(ActionPersistOptions.PersistBeforeAction)
.IsExposedToMobile(true)
.MassProcessingScreen<UpdateCaseMassProcess>());

Because it’s defined this way, overriding it will be much trickier.

One way to do it would be to extend the default workflow and update the Open action to include your changes. The problem is that workflow code is very restrictive by nature and significantly different than normal event / action code.

The alternative would be to add a brand-new graph action on CRCaseMaint called Open which would do what you want. Then you could update the workflow code to include your new action as an existing graph action rather than creating a new workflow action. In this way, I believe both could exist simultaneously.

I’m afraid this is probably more complicated than you were expecting.

I would love for someone to tell me there’s a much simpler option.

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