Skip to main content

Hi There,

 

When I add a show a message rule and use the message type confirmation, rules are still executed even if the end user clicks cancel on the confirmation dialogue. I would expect the cancel button to stop execting any rules and simply close, what am I doing wrong?

Please see some of the blogs below, perhaps they are of relevance:


 


https://startrule.wordpress.com/2014/09/10/smartforms-get-confirmation-more-elegantly/


https://codecodecode.ninja/2015/04/k2-smartforms-how-get-confirmation-from-user-action-works/


http://community.k2.com/t5/K2-blackpearl/Using-smartforms-rule-quot-Get-Confirmation-from-user-quot/td-p/64358


 


You may need usage of if/else and possibly an advance condition to achieve this functionality.  There is also an 'stop rule execution' action if applicable/needed.


MrSafe,

 The show message rule will not automatically stop rule execution. You will need to create a rule structure that tells the form to stop executing rules if a certain condition exists. In this case it would be the condition that triggers a Show Message rule. The way I accomplish this is by using unbound rules. Then on button click I just call the rules in the order I want to see them executed. The unbound rule looks like this.

 

 

I hope this helps. Let me know if you have any questions.

 

Thanks,

Bryan Peters


Agreed a normal show message rule will not stop rule execution but this is confirmation message, there is no way to tap into the outcomes of the confirmation message so as far as I am aware the confirmation type meesage action should cease to execute rules if the end user click cancel. I have plently of examples where this functioning as expected so this seems a little strange.

 

EDIT: Just checked the form again and I have another button in the same form with confirmation message rule bound to it, this one behaves as expected, user clicks cancel, nothing happens.  The onlt difference between the 2 is the broken one has an if else immediately after the show message whereas the functioning one does not. Raised a ticket with support will post outcomes. Incidentally I cannot see the images above but thanks very much for the input.

 

EDIT EDIT: I have narrowed it down to an issue with suceeding if else staements. If there is an if else stament anywhere after the confirmation message action, the stament will be evaluated regardless of the users decision in the confirmation message action. I did this by adding 1 confirmation message action followed immediately by a deafult message action, I then added and if else rule and placed deafult message action inside each clause. WHen the end user clicks cancel the default message action that is after the confirmation does not fire, however, the message action iside the true branch of the if else does.


According to K2 support this is by design, although the feature request to get this sorted is in place as others have encountered the same issue. There are a coupple of workarounds:

 

1) As illuded to above you can do and advanced condition of 1 =1 and use the "Get conformation from user" action inside an if of an if else statement, stopping rule execution in the else clause

2) You can move the if else update logic to before the confirmation message action and fire off the update method again based on the outcome

 

In my case I used the second one as it fitted my requirements but both are valid if a little fudge like!!!!


Reply