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?
How to dynamically change NavigateURL property of a button?
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.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.