Solved

Custom Actions - Add to Action Menu - ARInvoiceEntry vs. APInvoiceEntry / JournalEntry

  • 22 June 2022
  • 4 replies
  • 333 views

Hi,

I have extension classes for the ARInvoiceEntry, APInvoiceEntry and JournalEntry, each has a action button called “ChangeSomeField”, which needs to be on the Action Menu.

For ARInvoiceEntry, the base class has an ActionsMenuItem.AddMenuAction() which I can use to add the action to the action menu.  From what I can see in the code this is because they ARDataEntryGraph which implements the IActionsMenuGraph.

For both APInvoiceEntry and JournalEntry, from what I can see they’re base classes do not implement this interface which means I can’t access the ActionsMenuItem.AddMenuAction() to add the actions to the action menu.

In APInvoiceEntry and JournalEntry extension classes, how do I add custom actions to the action menu?  Do I need to implement that IActionsMenuGraph myself on my extension classes or is there another way.  Could I please have an example if either of the above two are correct?

icon

Best answer by rualdventer64 24 June 2022, 13:34

View original

4 replies

Userlevel 6
Badge +4

What version of Acumatica are you on?  Older versions are added via AddMenuAction, but more recent releases have converted to the new workflow engine.  If you check the code repository and find a file called ARInvoiceEntry_Workflow.cs in the PX.Objects/AR folder, then you will know you are on the new workflow engine.

In the new workflow engine, here is the simple version of adding an action to the 3 dots menu via code.  Workflow gets significantly more complex beyond this, but this example where I simply added a an action to Sales Order should get you started.  My version is 2022R1, which is slightly different than 2021R2.

 

using PX.Data;
using PX.Data.WorkflowAPI;
namespace PX.Objects.SO.Workflow.SalesOrder
{
    public class SOOrderEntry_Workflow_SSCS : PXGraphExtension<SOOrderEntry>
    {
        public static bool IsActive() => // Insert IsActive code here


        #region Initialization
        public override void Configure(PXScreenConfiguration config)
        {
            Configure(config.GetScreenConfigurationContext<SOOrderEntry, SOOrder>());
        }

        protected virtual void Configure(WorkflowContext<SOOrderEntry, SOOrder> context)
        {
            context.UpdateScreenConfigurationFor(screen =>
            {
                return screen
                    .WithActions(actions =>
                    {
                        actions.Add<SOOrderEntry_Extension>(g => g.RecordOutage, a => a.WithCategory(PredefinedCategory.Actions));
                    });
            });
        }
        #endregion

    }
}
 

On 2021 R2, build is 21.118.0038

Hi, for APInvoiceEntry and JournalEntry I was able to add the custom action to the Actions menu using the screen editor as below.

 

 

Userlevel 7
Badge

Thank you for sharing your solution @rualdventer64 !

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