How to add an action and handler to the Process Sh

2019-06-08 06:00发布

问题:

How do I add an action and handler to the Process Shipments screen? We want to add an action to the Action combobox on screen SO503000, and then add a handler in code to process the new action. We want to do this without having to override the huge switch/case statement for Action in the SOShipmentEntry graph.

回答1:

The PXAutomationMenu attribute pulls from Automation Steps all actions, which have appropriate processing screen set up as Mass Processing Screen:

To extend the list of actions available on the Process Shipments screen, please proceed as follows:

  1. Declare custom action within a BLC extension and invoke AddMenuAction method during BLC initialization to add it as a drop-down item for the Actions button

  2. To add custom action to the Process Shipments screen, add custom actions to appropriate automation step(s) and specify Mass Processing Screen ID. When user selects your custom action, Shipments from all Automations Steps, that contain a custom action, will be available for selection on the Process Shipments screen:

Two extensions (of the same 1st level) declared for the SOShipmentEntry BLC, as shown in the code snippet below, can be used to extend Actions drop-down with multiple customization projects (two customization packages that are independent of each other; either one or both may be published on a particular site. And both add an action to the Process Shipments screen): To address this scenario, :

public class SOShipmentEntryExt1 : PXGraphExtension<SOShipmentEntry>
{
    public PXAction<SOShipment> Test1;
    [PXButton]
    [PXUIField(DisplayName = "Test Action 1")]
    protected void test1()
    {
        throw new PXException("Not implemented action: {0}", "Test Action 1");
    }

    public override void Initialize()
    {
        Base.action.AddMenuAction(Test1);
    }
}

public class SOShipmentEntryExt2 : PXGraphExtension<SOShipmentEntry>
{
    public PXAction<SOShipment> Test2;
    [PXButton]
    [PXUIField(DisplayName = "Test Action 2")]
    protected void test2()
    {
        throw new PXException("Not implemented action: {0}", "Test Action 2");
    }

    public override void Initialize()
    {
        Base.action.AddMenuAction(Test2);
    }
}


标签: acumatica