0
votes

I have created a new CREATE QUOTE button on Requisition screen that replace the standard button which located at Action menu. After trying to hide it on RQRequisition_RowSelected event, the button still appear and able to click when the requisition is on Pending Quote Status. Kindly need advice how to hide it.

Customized Requisition Screen

2

2 Answers

1
votes

To hide or show an action button, you should redefine the Visible parameter of the PXUIField attribute for the button. You can change attributes of an action button by using one of the following approaches:

  • Dynamically at run time, in the Initialize() method of the graph extension
  • Statically, by overriding the action attributes in the graph extension

To Hide an Action Button at Run Time

In the graph extension, add the following code.

public override void Initialize()
{
  base.Initialize();
  Base.MyAction.SetVisible(false);
}

In the added code, replace MyAction with the action name.

To Hide or Show an Action Button Statically

To override action attributes in a graph extension statically, 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. Having redeclared the member of PXAction, you prevent the action delegate execution from infinite loops.

  1. Explore the original action declaration and copy the declaration to the graph extension.

  2. In the action declaration, set to false the Visible parameter of the PXUIField attribute, as the following code snippet shows.

    ... [PXUIField(…, Visible = false)] ...

  3. Replace the action delegate with the following code template.

    public virtual IEnumerable myAction(PXAdapter adapter) { return Base.MyAction.Press(adapter); }

  4. In the code template, replace myAction and MyAction with the appropriate names.

  5. In the template, redefine the action delegate arguments and return type according to the signature of the base action delegate.

If you have a customization that replaces an original action declaration statically, after upgrading Acumatica ERP to a new version, a new functionality of the same action may became unavailable.

Also, if a callback command for the button is declared in the PXDataSource control, you can hide the button by customizing the ASPX code. To do this, in the Layout Editor, expand the PXDataSource control, select the appropriate PXDSCallbackCommand element, and set to False the Visible property of the element.

0
votes

CREATE QUOTE button on the Requisition screen is implemented like a normal action in the RQRequisitionEntry BLC:

public class RQRequisitionEntry : PXGraph<RQRequisitionEntry>
{
    ...

    public PXAction<RQRequisition> createQTOrder;
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntry)]
    [PXUIField(DisplayName = Messages.CreateQuotation)]
    public virtual IEnumerable CreateQTOrder(PXAdapter adapter)
    {
        ...
    }

    ...
}

However, CREATE QUOTE button is added into the Actions drop down via Automation Steps:

enter image description here

With that said, the best way to customize the CREATE QUOTE button is by re-declaring the action within the RQRequisitionEntry BLC extension following sample below. I would be happy to come up with a more specific sample, if you provide additional details regarding your request.

public class RQRequisitionEntryExt : PXGraphExtension<RQRequisitionEntry>
{
    public PXAction<RQRequisition> createQTOrder;
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntry)]
    [PXUIField(DisplayName = RQ.Messages.CreateQuotation)]
    public virtual IEnumerable CreateQTOrder(PXAdapter adapter)
    {
        return Base.createQTOrder.Press(adapter);
    }
}