Action rules - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Action rules

Last post 03-14-2019 06:25 AM by zakaria.botros. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-26-2019 04:00 AM

    Action rules

    Hi all Found myself encountering an unusual problem and I cannot get to the bottom of it. We have several browser forms and on them we commonly use action rules to update a hidden value. More often than not we use it to collate scores as forms are filled out, so for example the user fills in text box A and it adds a +1 to the value of the score field. Usually this works without any issues but on our latest form the rules seem to be refreshing every time the form is opened and this causes the scores to get multiplied. I cannot for the life of me identify the cause of the problem. Usually we apply rules to fields, they run as the form is updated and remain static when the form is next opened until those particular fields are edited. I see no reason why the rules would automatically run again when the form is opened when the fields affected have not at that point been subjected to any changes. Any help would be appreciated. Jed W
    Filed under:
  • 02-26-2019 08:04 AM In reply to

    Oooooh interesting. Do any of the fields have any default values - perhaps something is causing one of those to update.... I think I would try to test this in design mode in preview, so I could find out what field might be changing. Since browser forms sometimes behave differently than filler, browser issues don't always reproduce in preview, but that's where I like to start. Open your form in design mode, and download one of your filled out forms that displays this issue. Under File > Form Options > Preview, you can browse to an existing file to preview with. Preview, and see if the multiplying of the score happens. If it does, temporarily change the compatibility of your form to Filler - and on each of the fields involved in the calculation, add a rule to pop up a message box with a distinct message, like "subtotal changed" or "item A score changed" or what-have-you. Preview your form, see which fields pop up a message box (which would indicate they "changed" and the rule fired). If any pop up a message, from preview, use File > Save As to save a new copy of the XML, and then you can compare the original with the new to see what is different in the field. Now - if the issue won't repro in preview, you can do something similar in the browser - I just add a field for collecting my messages, add a rule on each field involved to concat a new value to that field, so I end up with a single field with a value like "subtotal changed | item A score changed" etc - that can help me at least track down which field has changed. I'm hoping I'm explaining this well enough to help you get a start on debugging this - but please let me know if you need more detail. :)
    Hilary Stoupa

  • 02-26-2019 01:13 PM In reply to


    Hi Hilary. Thank you for the very detailed reply. To answer your question yes some fields did have default values and in addition a handful  are looking up external datasources. Based on the rules applied throughout the form nothing in particular stood out as the cause of the problem yet it was clear that something was indeed acting up. Sadly I cannot test your advice just yet because soon after posting my question I decided to bite the bullet and reverse engineer my form (luckily still early in development so nowhere near as many rules as we typically employ...yet).

    I basically printed off a copy of the rules inspector for reference and then deleted every action rule applied on the form (with button rules being the exception). Once done I added a single action rule onto the form to increase one of the scoring fields and then opened an existing form. Sure enough it worked fine with no scoring duplication. So it seems somewhere in one of the rules something was not quite right. I am slowly working to re-input all rules as we speak (set up exactly as they had been previously) but publishing incrementally to establish exactly which rule is the culprit.

    So far the results are positive which is perplexing however if I do encounter the rogue rule I'll let you know what I believe the issue to have been. If I re-build the rules and find myself hitting the same issue i'll follow your excellent advice above and see if that helps. 

     Thanks very much, your advice is greatly appreciated.


  • 02-27-2019 04:10 AM In reply to

    Hi again. So I started the process of building up my action rules from scratch, publishing frequently to try and identify which field/s are at fault. It took a while but I think I have found the fields causing the issue. The two fields in question that trigger the error (there may be more but I have not gone further than this section) are both rich text fields. Before adding rules to them the form works fine and all other rules behave as expected. The second I add an action rule to either rich text field I get the issue with the form seemingly running all rules again upon opening the form causing the unwanted duplication/field changes.

    I would have blamed the field type had I not have applied rules to a rich text box in the past, seemingly without issue, so this has me stumped.

    For clarity the typical action rule I am using is as follows:


     Richtextfield: Increase score

    Conditions: Richtextfield != ""

    Actions: Set a field's value: Sectionscore = sectionscore + 1 


     It really is that basic. Am I missing something really obvious??? Also of note is that each rich text box contains a validation rule that is working exactly as expected and causing no problems at all.







  • 02-27-2019 09:02 AM In reply to

    I wonder if on re-open InfoPath in the browser is doing ... something to the inner HTML of the rich text that is causing this. Have you checked your other forms that have similar logic? Are they still all working as expected? I wouldn't expect a validation rule to cause issues - those are different from action rules, as long as the value is still valid, I'd expect a change in the value wouldn't affect them. I'd save a copy of the XML from the site, then open, save, and compare the rich text in the resaved XML to the original - any diff?
    Hilary Stoupa

  • 03-14-2019 05:17 AM In reply to

    Hello Hilary Stoupa, Hello JedWalker, I need help for the same issue with action Rules but in a different concept. I'm trying to set approval decision date " Text field control, of type text, not date. I tried the type date it made the same behavior" to be automatically set to now function or concatenate of now function when the user chooses option buttons related to the approval decision itself it either approve or reject. the rule is: set field value . = today() ------- condition is approvaldecision = Approve or Reject or Notblank when I preview the form and I modify the approval decision option buttons to approve or reject nothing happen and the text field is empty. What do you think about the reason ? or solution? For who is interested there are a similar problem at:
  • 03-14-2019 06:15 AM In reply to

     I'd love to help but my knowledge is nowhere near on par with Hilary's.

    In the end (which I started to do before Hilary replied with her advice) I opted to take out the rich text boxes entirely. I learnt that I could add plain text boxes without the concern of character limits by ensuring that they are inputted as 'NoteplainType' rather than 'TextType' and for whatever reason my issues vanished when I did this. I never got to test what Hilary posts above but did solve the issue so i'm happy enough. I would have loved to understand the true nature of the problem to avoid such mishaps in the future but given the timescales of the work I need to complete I just have to take this and a win and leave the 'why' as a mystery.

  • 03-14-2019 06:25 AM In reply to

    Thank you JedWalker for your fast response, and I'm on the same page with you. this kind of projects takes more time than expected because too many tiny details and issues to solve. so we leave 'why' as a mystery
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.