Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Bug in CRMScript > Triggers

Hi All,

I think I have found a bug in CRMScript > Triggers.  I would assume because it is an SDK bug it better to report it here, rather than using support.

Basically my script prevents a user from moving past a certain sale stage if they have not created a specific document against. the same.  But I can demonstate the issue I have found in just a few lines of code.

The code below basically raises an error if the Id of the sale stage is greater than zero.

EventData ev = getEventData();

If (ev.getInputValue("SaleEntity.Rating.Id").toInteger() > 1)
{
  ev.setBlockExecution(true);
 ev.setMessage("You cannot take this sale beyond this stage.");
}

To recreate the issue, create a sale and save it with the first avaiable sale stage (with id of 1).  Sale saved correctly.  Move the stage to a different stage, and you correctly get the error.

Now if I change the sale stage again, whilst still in edit mode of the sale, as soon as I change the drop down, the trigger fires again, as if it is trying to save the sale (this is without clicking the save button).

Not too big a problem, but what if I now change the stage back to a valid stage, as I really want the rest of my changes to the sale to be saved.

As soon as I change the stage to the first stage with the id of 1, the sale saves.  But it does not save the sale against this stage, in fact it removes the stage all together.  Even if I refresh the web browser the stage has still been removed from the sale, which could cause the customer quite an issue.  I have tested this on SuperOffice 8.3 R01.

Am I missing something, or does this need raising as a bug.

Many thanks,

Trevor

RE: Bug in CRMScript > Triggers

Hi, Trevor. This sounds similar to an issue we're having with CRMScript Trigger in Sale as well.

In our case the script will block the save if Source is not set, by displaying a messagebox. The users typically get the message when on the first tab in Sale. After clicking away the warning the script will fire again just by navigating to the More-tab. So that is the first unexpected behavior. Secondly, if the user has set the salestage to Sold at the same time, we see that the rating percentage (which for Sold sales is supposed to be 100%) falls back down to 1%. Thats the second weird behavior.

Having said that we're really happy with the new Triggers functionality. It is one of the biggest game-changers in Web-customizations for a long time. We've taken almost all the complex customizations at a 1500+ user site, and ported them over to Triggers instead, and have found it much more easy to work with than previous solution. Not having to replace files on disk, and not having to do iisreset makes life a whole lot easier.

There are a couple of these minor issues like you have, but hopefully they will get sorted out as more and more developers start using Triggers.

Av: Frode Lillerud 16. jun 2018

RE: Bug in CRMScript > Triggers

Hi Frode,

Ageed, this new scripting layer is brilliant, and could be even better with things such yes/no message boxes etc. but even in it's current early state does open some exciting possibilites.  Let's Just hope these small bugs get resolved soon.

Trevor

Av: Trevor Sharp 18. jun 2018