I'm using CRMScript to set the Credited field as mandatory on a sale. I've got lots of these mandatory scripts running in this solution for fields on sale, but the one for Credited is a little different and it is just enough that it ends up in an infinite loop trying to display the messagebox.
The trigger-script looks like this:
* Credited on Sale is mandatory
EventData ed = getEventData();
Map inputs = ed.getInputValues();
if (ed.getInputValue("SaleEntity.Credited.Id").toInteger() <= 0)
ed.setValidationMessage("Credited must be set before saving.");
The only difference between this script, and the other scripts that work fine, is that here I try to navigate the GUI to the "Details" tab, since the Credited field is only shown on that page. I want to help the users find the correct place to fix their problem.
The consequence is that I get just a bunch of messageboxes on top of each other, and the GUI locks up.
How can I navigate without breaking the UI?