Override Action – Confirmation Dialog

Hi Everyone,

Want to give you an example of how to modify an action in Acumatica. specifically I’ll customize a Release action on Payments and Applications with adding a Confirmation Dialog with conditions.

To customize an action we should follow the Acumatica customization guide.
In simple words we should do following:

  1. Find the original action.
  2. Create a graph extension.
  3. Redefine the original action with the same parameters.
  4. Add own logic in the new action.
  5. Call base action code.

Base Action Code
To find the original Action you can use Source Code browser.
Acumatica Source Code

Custom Code
Your code will be called instead of the base action. You can put your custom code before, after or instead of the base code executed.
I recommend you to try to not replace fully original code wherever where it is possible, as it will be easier for you to upgrade customization for a new version.
In our case the main customization is calling the dialog – Base.Document.Ask(“”)

Calling Base Action
To call the base Action and trigger the original logic, we can use reference to original Graph thought Base:
return Base.Release(adapter);

The full code example is here:

public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry>
  {
    public PXAction<APPayment> release;
    [PXUIField(DisplayName = "Release", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
    [PXProcessButton]
    [APMigrationModeDependentActionRestriction(
      restrictInMigrationMode: false,
      restrictForRegularDocumentInMigrationMode: true,
      restrictForUnreleasedMigratedDocumentInNormalMode: true)]
    public virtual IEnumerable Release(PXAdapter adapter)
    {
      APPayment row = Base.Document.Current;
	  
      AccessInfo info = Base.Accessinfo;
      if(row.AdjDate != info.BusinessDate && 
         Base.Document.Ask("Application date does not equal to Business date, do you really want to release payment?", MessageButtons.YesNo) 
           != WebDialogResult.Yes) return adapter.Get();
  
      return Base.Release(adapter);
    }
  }

Here is the result you can test in the UI:
Acumatica Action Dialog

Have a nice development!

1 Reply to “Override Action – Confirmation Dialog”

Leave a Reply

Please rate*

Your email address will not be published. Required fields are marked *