Acumatica 将自定义操作添加到";行动“;下拉分机

Acumatica 将自定义操作添加到";行动“;下拉分机,acumatica,Acumatica,我正在尝试将自定义定义的操作之一添加到SOOrder页面中已存在的操作下拉列表中。我的代码定义如下: public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry> { public PXAction<PX.Objects.SO.SOOrder> customAction; [PXButton(CommitChanges = true)] [PXUIField(Displa

我正在尝试将自定义定义的操作之一添加到SOOrder页面中已存在的操作下拉列表中。我的代码定义如下:

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
    public PXAction<PX.Objects.SO.SOOrder> customAction;

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Custom Action Title")]
    protected void CustomAction()
    {
        //stuff
    }

    public SOOrderEntry_Extension()
    {
       Base.action.AddMenuAction(customAction);
    }
}
public PXAction<PX.Objects.SO.SOOrder> ActionsMenu;
[PXButton]
[PXUIField(DisplayName = "Actions")]
protected virtual void actionsMenu()
{
}
但我还是得到了同样的空引用。我还尝试了以下代码:

public SOOrderEntry_Extension()
{
   Base.action.MenuAutoOpen = true;
}
只是想看看会发生什么,也得到了相同的空引用错误:

[NullReferenceException:对象引用未设置为对象的实例。]

编辑:Stackoverflow不允许我在blockquotes中包含以下部分,因为它类似于代码。如果有人能解决这个问题,那就去做吧

   PX.Data.PXGraph.CreateInstance(Type graphType, String prefix) +529
   PX.Web.UI.PXBaseDataSource.InstantiateDataGraph(Type type) +20
   PX.Web.UI.PXBaseDataSource.f(Type A_0) +400
   PX.Web.UI.PXBaseDataSource.g(Type A_0) +146
   PX.Web.UI.PXBaseDataSource.get_DataGraph() +302
   PX.Web.UI.PXBaseDataSource.k() +188
   PX.Web.UI.PXBaseDataSource.GetCommands() +69
   PX.Web.UI.PXBaseDataSource.GetCommandStates() +74
   PX.Web.UI.PXGrid.p() +132
   PX.Web.UI.PXGrid.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +476
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +149
   PX.Web.UI.PXGrid.CreateChildControls() +85
   System.Web.UI.Control.EnsureChildControls() +92
   System.Web.UI.WebControls.CompositeDataBoundControl.get_Controls() +16
   PX.Web.UI.PXSmartPanel.a(ControlCollection A_0, Boolean A_1, Boolean A_2) +257
   PX.Web.UI.PXSmartPanel.a(Boolean A_0) +98
   PX.Web.UI.PXSmartPanel.SetBindingState(Boolean load) +101
   PX.Web.UI.PXSmartPanel.OnInit(EventArgs e) +64
   System.Web.UI.Control.InitRecursive(Control namingContainer) +139
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +408

此时,我不确定要如何将此自定义操作添加到下拉列表中,但我已经关注了有关堆栈溢出的其他帖子,无法找到解决方案。我也查看了T200,但找不到关于如何执行此任务的任何直接建议。

您应该将用于在基本操作菜单中添加自定义操作的代码添加到要初始化的覆盖中。在图形扩展中尝试此操作,并删除已有的构造函数调用

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
    public PXAction<PX.Objects.SO.SOOrder> customAction;

    [PXButton]
    [PXUIField(DisplayName = "Custom Action Title")]
    protected void CustomAction()
    {
        //stuff
    }

    public override void Initialize()
    {
        base.Initialize();
        Base.action.AddMenuAction(this.customAction);
    }
}
public类SOOrderEntry\u扩展名:PXGraphExtension
{
公共行动;
[按钮]
[PXUIField(DisplayName=“自定义操作标题”)]
受保护的void CustomAction()
{
//东西
}
公共覆盖无效初始化()
{
base.Initialize();
Base.action.AddMenuAction(this.customAction);
}
}

您应该将代码添加到基本操作菜单中的自定义操作,以覆盖初始化。在图形扩展中尝试此操作,并删除已有的构造函数调用

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
    public PXAction<PX.Objects.SO.SOOrder> customAction;

    [PXButton]
    [PXUIField(DisplayName = "Custom Action Title")]
    protected void CustomAction()
    {
        //stuff
    }

    public override void Initialize()
    {
        base.Initialize();
        Base.action.AddMenuAction(this.customAction);
    }
}
public类SOOrderEntry\u扩展名:PXGraphExtension
{
公共行动;
[按钮]
[PXUIField(DisplayName=“自定义操作标题”)]
受保护的void CustomAction()
{
//东西
}
公共覆盖无效初始化()
{
base.Initialize();
Base.action.AddMenuAction(this.customAction);
}
}

在6.1中进行了测试,按钮显示在“操作”菜单下。布兰登,你棒极了!在6.1中测试,按钮显示在操作菜单下Brendan,你太棒了!