Search code examples
c#acumaticaacumatica-kb

Acumatica customer screen custom button click issue


In acumatica customisation project , in customer edit screen (AR303000) I added one new tab Item called Sanctions . In that tab item , I put one grid and one Button . On that button click I want to execute function ExecuteSanctionsCheck() .

I added button as in below code

<px:PXTabItem Text="Sanctions">
     <Template>
         <px:PXLayoutRule runat="server" StartColumn="True" ID="CstPXLayoutRule4" />
         <px:PXFormView runat="server" Caption="Test" ID="CstFormView5" DataMember="CurrentCustomer">
             <Template>
                 <px:PXGrid ID="grid" runat="server">
                     <Levels>
                         <px:PXGridLevel DataMember="CurrentCustomer">
                             <Columns>
                                 <px:PXGridColumn Width="350px" DataField="UsrCheckMessage" />
                             </Columns>
                         </px:PXGridLevel>
                     </Levels>
                 </px:PXGrid>
                 <px:PXButton ID="btnSanctionsResult" runat="server" CommandName="SanctionsResult" Text="Sanctions Result" />
             </Template>
         </px:PXFormView>
     </Template>
 </px:PXTabItem>

I have added the event in CustomerMaint Extenstion as shown . But the click event not working. Why ?

public class CustomerMaintExt : PXGraphExtension<CustomerMaint>
{
    public PXAction<Customer> SanctionsResult;
    [PXButton]
    [PXUIField(DisplayName = "Sanctions Result")]
    protected virtual IEnumerable sanctionsResult(PXAdapter adapter)
    {
        ExecuteSanctionsCheck();
        return adapter.Get();
    }
}

Solution

  • Add your button this way:

    <px:PXButton runat="server" ID="btnSanctionsResult" Text="SanctionsResult"> 
        <AutoCallBack Command="SanctionsResult" Target="ds" /></px:PXButton>
    

    You need to use the Command from AutoCallBack, and set the Target to the data souce (ds).

    FormEditor