Solved

how to access and enable/disable standard buttons on smart panels

  • 7 March 2022
  • 3 replies
  • 378 views

Userlevel 7
Badge +8

By using PXUIFieldAttribute.SetEnabled we can access to the fields and modify their properties. I was wondering how.we can access to the standard buttons like as ok, cancel … on the smart panels and modify their properties?

icon

Best answer by aaghaei 9 March 2022, 06:04

View original

3 replies

Userlevel 5
Badge +3

Create a button for your smart panel and assign the dialog result to the desired option.

 

 

Than in your code you can access the action like any other. Make sure that the panel button is set to the correct CommandName and CommandSourceID.

Userlevel 7
Badge +17

 Hi @aaghaei  I just worked on a similar kind of requirement.

In the smart panel, I have added 3 buttons Add, Add&Close, and Cancel. Provided the command names at the Smart Panel (.aspx page)

In the Row_Selected event, written a condition like, if the provided value is less than 5 then I’m disabling the buttons (Add and Add&Close) and if the value is more than 5 then I’m enabling the smart panel buttons

 

Please find the screenshots for reference.

 

 

 

Userlevel 7
Badge +8

Thanks @Naveen B & @yhartman,

yes, with a little bit of help I figured this out. Here is what I did.

 

        protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = e.Row as APInvoice;
if (row != null)
{
bool Enabled = (row.Status == APStatuses.PendingApproval || row.Status == APStatuses.Rejected || row.Status == APStatuses.OnHold) ? true : false;
route.SetEnabled(Enabled);
}

if (RoutingPanelDialog.Current != null)
{
bool Enabled = false;
Enabled = (RoutingPanelDialog.Current.Status == EPStatuses.Routed) ? false : true;
PXUIFieldAttribute.SetEnabled<EPRoutingPanelDialog.step>(cache, null, Enabled);

Enabled = false;
if (RoutingPanelDialog.Current.Step != null)
{
if (RoutingPanelDialog.Current.Owner != null || RoutingPanelDialog.Current.Workgroup != null)
{
Enabled = true;
}
}

ChangeOk.SetEnabled(Enabled);
}
}

 

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