CRMScript for Web-version stuck in endless loop when setNavigateTo and setValidationMessage combined

Hi,

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:

#setLanguageLevel 3;

/*
 * Credited on Sale is mandatory
 */

EventData ed = getEventData();
Map inputs = ed.getInputValues();
if (ed.getInputValue("SaleEntity.Credited.Id").toInteger() <= 0)
{
  ed.setNavigateTo("sale.udef");
  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?

RE: CRMScript for Web-version stuck in endless loop when setNavigateTo and setValidationMessage combined

I think setting message and navigation combined does not work well. I don't have a good solution for you until we improve the system.

Sverre

Av: Sverre Hjelm 12. mar 2018

RE: CRMScript for Web-version stuck in endless loop when setNavigateTo and setValidationMessage combined

Hi ,

Having the same troubles.

It would be great if there was an option to have a "setMessage" with return values .

if (ed.setMessage("Do you want this feature?","Yes","No","Maybe") == "1"){

   ed.setNavigateTo("soprotocol:contact.main?contact_id=1);

}else{

ed.setNavigateTo("soprotocol:contact.main?contact_id=2);

 

any plans ? 

Av: Mehmet Canavar 24. mai 2018

RE: CRMScript for Web-version stuck in endless loop when setNavigateTo and setValidationMessage combined

Hi

I'm having the same issue, are there any plans to make setNavigateTo and setValidationMessage work together, or is there some other way to do it?

Espen

Av: Espen Steen 21. jan 2020