Tag : slow

InfoPath – Using a field to identify Form Load issues

When you open many data connections and perform queries through the ‘Form Load’ functionality in InfoPath, it may be that your form takes long to open. To troubleshoot these issues, you can create a local field in InfoPath and write the rule and time to this field each time an action is performed. When the form finally opens, you can query this field to see where the lag is. Example:

  1. Separate your Form Load into multiple rules, grouped by logical function such as ‘Getting Initial User Data’ or ‘Query Attachments’
  1. Add a text field called ‘Log’ and at the very beginning of the first rule, initialize it with something similar to the following:

concat(“Getting Initial User Data:”, string(now()), “,”)

  1. Then, at the beginning of each subsequent rule, and perhaps sometimes within the rule itself, set the field ‘Log’ to a value similar to the following:

concat(Log, @crlf, “Query Attachments:”, string(now()), “,”)

(Note that the field @crlf which formats the field neatly, originates from an XML Data Connection. See ‘InfoPath – Adding special characters such as line feeds’ for more information on how to do this)

  1. Display the ‘Log’ field somewhere on your form (I normally add this to a special view that only administrators have access to – the button to open this view is not displayed if the user is not an administrator
  1. When you view the field, it will have something like the following in it

Getting Initial User Data:2016-05-30T15:54:02,
Query Attachments:2016-05-30T15:54:02,
Query Related Documents:2016-05-30T15:54:02,
Query Item Prices:2016-05-30T15:54:17,

From the above, we can see that there is a problem with the Query on Related Documents since it is taking almost 15 seconds to process based on the time that the ‘Query Item Prices’ is starting