Action Customization: Overriding of an Action Delegate Method
An action from a base graph is always completely replaced by the identically named action declared within a graph extension.
To override an action delegate method in a graph extension, you should declare both the graph
member of the PXAction type and the delegate. You should attach a new set
of attributes to the action delegate declared within the graph extension. Also, you need to
invoke the Press() method on the base graph action. Because you have
re-declared the member of PXAction, you have prevented the action delegate
execution from infinite loops.
Note: If you have a customization that replaces an original
action declaration statically, after you upgrade MYOB Acumatica to a new
version,
the new functionality of the action may became unavailable.
You do the following to override an action delegate method:
- Explore the original action declaration, and copy the declaration to the graph
extension, as described in Action Customization: Customization of an Action.Attention: We recommend that you not remove or change any attributes of the action.
- In the action declaration, replace the action delegate with the following code
template.
public virtual IEnumerable myAction(PXAdapter adapter) { return Base.MyAction.Press(adapter); } #endregion
- In the code template, replace
myAction
andMyAction
with the appropriate names. - In the template, redefine the action delegate arguments and return type based on the signature of the base action delegate.
- Implement the needed code in the override action delegate.