I’m trying to dynamically update the NavigateURL property of a button using an event handler. Is this possible? Has anyone else ever managed to do this?
Hi
Can you please share more details of the scenario that requires this?
As you are invoking the action, I think you can set the redirect URL directly in the action’s method based on the condition. Below is an example of the suggestion,
public PXAction<SOOrder> action;
PXUIField(DisplayName = "Open Window")]
PXButton]
protected IEnumerable Action(PXAdapter adapter)
{
if (Base.Transactions.Select().Count > 0)
{
string url = "https://www.acumatica.com";
throw new PXException($"Redirect0:{url}$target=_top");
}
else
{
string url = "https://www.google.com";
throw new PXException($"Redirect0:{url}$target=_top");
}
return adapter.Get();
}
Good Luck,
We have created a button that should change the NavigateURL of that button to a different value based on the value in a specific field of the record when the record is selected OR when that specific field is changed/updated.
In the case, you can check the values of those fields with the action method itself → change the NavigateURL → Redirect. So I don’t think you we need to use event handlers in this case.
Please correct me if I’m not getting the scenario right. Thanks,
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.