• vadim@workflowexcellence.com
  • Utah, United States

Nintex Workflow – Update XML Part 2 – Updating InfoPath Forms

The Nintex Workflow Update XML action, as I mentioned in the first Update XML Action article, can be used to update not only simple XML, but also InfoPath forms that users have filled in.

Whether it is simple XML or an InfoPath form, you still need to know the structure of the XML. Not knowing the structure, you could quite easilly break something in the XML. Especially if there is a process that is expected to read the XML later.

What I have noticed, is that users have a variety of reasons why they would want to update the XML in an InfoPath form. One example would be, that after a workflow process completes, they want to update a field in the InfoPath form and notify users that the process is over. Part of that notification is a link to the InfoPath form, and they can see all the information that has been added/updated and then look at their status field to see that it is complete.

Another instance, is when users want to add rows of data to a repeating table in the form. I honestly can’t think of a reason why right now, but I’m sure the business reasons are there, otherwise I would never have heard of it.

So updating an InfoPath form using the Update XML action, to add to the repeating table is what I will focus on here.

Simple InfoPath Form

My form simply has 2 text boxes, which I will not be focussing on in this article, and two repeating tables, which I will focus on.

When you click on the first repeating table, you can see that its internal name is “group2”.

Clicking on the second table, it is called “group4”.

One thing to note, is that the fields in the repeating tables, I have right clicked on, and given them more descriptive names, so it’s easier for me later to make the appropriate changes to the XML form.

What does the XML look like?

Here is what my filled in form looks like.

The XML for this forms looks like this :

<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolution solutionVersion="1.0.0.4" productVersion="12.0.0" PIVersion="1.0.0.0" href="http://ntx-vadimdesk/RepeatingTablesForm/Forms/template.xsn" name="urn:schemas-microsoft-com:office:infopath:RepeatingTablesForm:-myXSD-2010-01-18T01-58-26" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-18T01:58:26" xml:lang="en-us">
  <my:fieldFirstname>Vadim</my:fieldFirstname>
  <my:fieldLastname>Tabakman</my:fieldLastname>
  <my:group1>
    <my:group2>
      <my:fieldUpcomingEvenstDate>2/2/2010</my:fieldUpcomingEvenstDate>
      <my:fieldUpcomingEventsEvent>Upcoming Product Launch</my:fieldUpcomingEventsEvent>
    </my:group2>
  </my:group1>
  <my:group3>
    <my:group4>
      <my:fieldCancelledEventsDate>1/1/2010</my:fieldCancelledEventsDate>
      <my:fieldCancelledEventsEvent>New Years recovery</my:fieldCancelledEventsEvent>
    </my:group4>
  </my:group3>
</my:myFields>

I’ve highlighted the groups that are already in a form that I have filled in. What this tells me, is that if I want to add my own entries into the repeating table, I just need to add similar XML nodes.

So when a user submits a form like this, I want my workflow to kick off, and add an entry into the Upcoming Events table, and also the Cancelled Events table.

What does the Update XML action look like to add an entry in a Repeating Table?

irst we need to add in the XPath expression to that the engine knows where you want to insert your new XML Node.

Then you need to make sure the “Add child node” radio button is checked.

Then submit the XML.

As you can see that I’m adding a new XML node that is called “group2” as shown in the screenshot of the InfoPath form when I was designing. It is being added to the “group1” node as that represents the complete repeating table.

You need to make sure that the XML Node you are adding is being added to the correct place, and that there are no mistakes in the XML node names, as any mistakes would make your InfoPath form corrupted and unusable.

The second Update XML action does something similar, except that it is adding a new “group4” node into the “group3” node as that represents the second repeating table.

Conclusion

My aim here, was to show you that updating an InfoPath form using the Update XML action is quite simple, and not something should look scary.

Original InfoPath Form :

Now I run my workflow and my form will look like this :

I didn’t find a way to rename my tables in the InfoPath form at design time, so that is why I had to deal with names such as “group1” and “group3” etc. But that would be what I expect would scare people away from updating InfoPath Form XML. Bute once you’ve done it once or twice, you’ll feel more confident about it.

Just remember to first test out your updates in a non-production environment, to confirm that you aren’t corrupting the XML. This isn’t specific to InfoPath Form XML. This is any XML that you are updating.

Important Files

Update InfoPath Form Repeating Table Workflow

Leave a Reply

Your email address will not be published. Required fields are marked *