Skip to main content

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  

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.


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 
            //}


        }


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.!


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