Solved

Customize Releasefromhold action in Check and Payments Screen

  • 19 December 2023
  • 4 replies
  • 96 views

Userlevel 3
Badge

Hi All,

I need to add a condition to release from hold to unhold event. Based on the condition need to block transferring to unhold status.

Can someone help me to achieve this?

Thanks

Bhagya  

icon

Best answer by Vignesh Ponnusamy 21 December 2023, 17:22

View original

4 replies

Userlevel 7
Badge +4

Hey @bhagyat25,

You can create conditions from the customization and use it to enable/disable actions.

Following example, demonstrates the steps to disable Remove Hold action based on the Payment Amount field.

  • Define the condition

 

  • Use the condition to Disable the action 

 

 

Outcome of the above setup, 

 

 

Hope that helps.! Feel free to post if you have any questions.! Good Luck,

Tip: If you have more complex conditions to check, you can enable/disable the action from the RowSelected event as well.

Userlevel 3
Badge

Hey @bhagyat25,

You can create conditions from the customization and use it to enable/disable actions.

Following example, demonstrates the steps to disable Remove Hold action based on the Payment Amount field.

  • Define the condition

 

  • Use the condition to Disable the action 

 

 

Outcome of the above setup, 

 

 

Hope that helps.! Feel free to post if you have any questions.! Good Luck,

Tip: If you have more complex conditions to check, you can enable/disable the action from the RowSelected event as well.

Hi @Vignesh Ponnusamy

Thanks for your reply. I need to write more complex condition and disable the button. As you mentioned I tried to use RowSelected event. But unfortunately I couldn’t complete that. My need is when vendor is selected check my condition if that false disable the “releaseFromHold” action with warning message. Can you please share sample code for me?

 protected void _(Events.RowSelected<APPayment> e)
        {            
            APPayment row = e.Row;
            if (row == null) return;

            //if(myLogic == false)
            //{
                //Show my message
                //Disable the releaseFromHold button 
            //}


        }

Userlevel 7
Badge +4

Hi @bhagyat25,

From the RowSelected event you can try something like below,

		protected void APPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (APPayment)e.Row;
if (row.DocDesc == "Test")
{
Base.releaseFromHold.SetEnabled(false);
PXUIFieldAttribute.SetWarning<APPayment.docDesc>(Base.Document.Cache, row, "Description is Test");
}
}

To set the warning you can use PXUIFieldAttribute.SetWarning for a specific field to set the warning.

Also, set CommitChange for the field to true to enable backend call when the field is updated,

 Good Luck.!

Userlevel 3
Badge

Hi @bhagyat25,

From the RowSelected event you can try something like below,

		protected void APPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (APPayment)e.Row;
if (row.DocDesc == "Test")
{
Base.releaseFromHold.SetEnabled(false);
PXUIFieldAttribute.SetWarning<APPayment.docDesc>(Base.Document.Cache, row, "Description is Test");
}
}

To set the warning you can use PXUIFieldAttribute.SetWarning for a specific field to set the warning.

Also, set CommitChange for the field to true to enable backend call when the field is updated,

 Good Luck.!

Thanks @Vignesh Ponnusamy 

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