Home Forum Blog Market Events Resources
Showing results for 
Search instead for 
Do you mean 
Highlighted
Contributor
Posts: 36
Registered: ‎03-19-2014
Accepted Solution

Confimration Message Issue

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?

Moderator
Moderator
Posts: 818
Registered: ‎05-08-2012

Re: Confimration Message Issue

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

 

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.

Frequent Contributor
Posts: 106
Registered: ‎10-12-2015

Re: Confimration Message Issue

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.

 

Stop Rule Execution.png

 

I do not always close the browser but in this case I did. I do use the message rule for some advanced validation. I generally use the validation rule under conditions but sometimes I have additional validations where I want to show a custom message. So "On button click" I will add my validation rule and then I will call all of the unbound rules. I put the advanced validation rule which shows a custom message at the top so if the condition isn't met it ends rule execution and does not create the entry.

 

Calling unbound rules.png

 

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

 

Thanks,

Bryan Peters

Contributor
Posts: 36
Registered: ‎03-19-2014

Re: Confimration Message Issue

[ Edited ]

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.

Contributor
Posts: 36
Registered: ‎03-19-2014

Re: Confimration Message Issue

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