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.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.