Skip to main content
Solved

i want to Override Action@Open at CRCaseMaint_Extension

  • August 10, 2023
  • 1 reply
  • 148 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.

Best answer by darylbowman

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.

View original
Did this topic help you find an answer to your question?

1 reply

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1715 replies
  • Answer
  • August 10, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings