Why do I get error message "Unable to execute transition XX on XX. One or more fields are invalid" when a Shell.Redomessage should stop the transition?

I have a transition that will Perform another transition from Actions, the second transition is a quick transition that runs a webservice. BUT as a Post-transition action on the quick transition we have an appscript that checks field values if it should be run or not. If not it sends a Shell.RedoMessage. That is all fine and the webservice is only running when is should but when it shouldn't we get a system error message "Unable to execute transition transitionname on projectname Itemnumber. One or more fields are invalid" 

So functionality is good but I don't want the error message

  • 0  

    It sounds like the quick transition is failing even before the script issues the Shell.Redomessage.  Is the second transition "S-order reject"?  Perhaps, try placing your script on the first transition.  Check for valid fields and if valid have the script run the next transition?

  • 0 in reply to   

    I have tested that the transition works well if not "stopped", and it is a simple script. Checking a few field values (but more than can be done in the Actions editor) and then either run the integration or not. The eventlog message and transition does fine and basically the Shell.Redomessage also does what it should except that it give the error.

    If fldvaluePRAL = 0 And fldValueISSUENO > 1 AND thisisageneralNewissue = "False" Then
        Call Ext.LogErrorMsg("Reject sent to PRAL")
    Else
        Shell.RedoMessage = "Do not send to PRAL"
    End If

    "have the script run the next transition", How do I do that?

  • 0  

    If I understand correctly, you have a complex set of steps and transitions that you want to be able to cancel part way through. I wonder if using a trigger would help. This is not the same use-case described in this post, but it does demonstrate a way to cancel a transition that should be run. Maybe you could work out something similar. The steps are here: https://knowledgebase.serena.com/InfoCenter/index?page=content&id=S138787 

  • 0 in reply to   

    Thank you, but unfortunately not what I am looking for. the only think I'm looking for is that the transition with the webservice action should only run during certain conditions. The functionality with the RedoMessage work except for the error message given. And I don't understand what fields that are invalid, but probably marked that way from the Shell.RedoMessage command. 

  • 0   in reply to 

    Hi, Based on your original description, I believe everything is working as designed from a product perspective. A RedoMessage doesn't prevent the transition from ever starting, it can at best guarantee it will fail.

    Therefore, you either need to allow it to fail silently or prevent it from attempting to run in the first place. For example, a fail silently approach could be that the script replaces the redomessage with a statement that manually sets the state back to where it needs to be. This is not the cleanest option, but it is a small change.

    Instead, it would be better to truly make the transition conditionally start. Options include triggers, actions, scripts, decisions, and orchestrations for starters.

    For example, on the first transition, have it run an asynchronous orchestration that conditionally runs the second transition (You may then even move your webservice call into the orchestration). Or, on the first transition set a field conditionally that then controls whether the 2nd transition is performed.

  • 0 in reply to   

    Thank you, I agree that the best would be to make the transition conditionally start. I have only found that I can get my conditions in a script. If I can run that script on the first transition and then fire the second transition from there, that would be a solution.

    Then back to the question: How do I "have the script run the next transition"?

    I do not want to involve orchestration.

  • 0   in reply to 

    I like to let SBM handle the transitioning when possible, not run it directly from the script. There are three ways that I would handle this scenario to run the next transition, which I'll refer to as Transition2, without using an orchestration.

    1. If you can add a "Restrict by Rule" to Transition2 to have it only valid when 'fldvaluePRAL = 0 And fldValueISSUENO > 1 AND thisisageneralNewissue = "False"', then you can trigger Transition2 always from Transition1. It will only run when the rule is valid.

    2. Create a hidden binary/trinary field, then set it to yes on your script. Then only trigger the transition on yes.

    3. Create a notification, that triggers on  'fldvaluePRAL = 0 And fldValueISSUENO > 1 AND thisisageneralNewissue = "False"' and run the transition.