Vadim Tabakman

 

Nintex Workflow - Update XML Part 2 - Updating InfoPath Forms

Statistics

  • Entries (279)
  • Comments (1769)

Categories

Posted by Vadim Tabakman Sunday, February 5, 2012 10:33:00 PM Categories: InfoPath Nintex Nintex Workflow Update XML
Rate this Content 0 Votes
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?

First 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
Copyright Vadim Tabakman

Comments

Monday, June 9, 2014 8:02:34 AM
Matthew Skinner
Gravatar

re: Nintex Workflow - Update XML Part 2 - Updating InfoPath Forms

Hello Vadeim, I have been reading your Nintex blogs - you have some great content and tutorials!

I am working on a solution where I need to update a Nintex Form repeating section in a list from a parsed CSV file. I have the CSV parse working but I am having trouble getting the data into another list within the Nintex repeating section of the nintex form.

Do you have any advice or tutorials on updating a Nintex form repeating table? I can only seem to find this information for InfoPath.

Thank you!

Monday, June 9, 2014 8:10:22 AM

re: Nintex Workflow - Update XML Part 2 - Updating InfoPath Forms

Hi Matthew,

take a look at this post : http://www.vadimtabakman.com/nintex-formsworkflow-parsing-repeating-section-data.aspx

It is about extracting data from a repeating section rather than putting data in.  Theoretically, if the form already exists, you should be able to update the form data (I haven't done this though).

cheers,

Vadim

Thursday, October 23, 2014 1:48:41 PM
Andrew Suiter
Gravatar

re: Nintex Workflow - Update XML Part 2 - Updating InfoPath Forms

Hi Vadim,

I had a question about updating XML and repeating tables in InfoPath,

- InfoPath Form Library with repeating table, user submits the form then through lazy approval I update a blank repeating field through the workflow.
- Nintex Workflow to update a field within the repeating table (I am using Update XML Action). This is working correctly.
- When I create a new Repeating table, the Workflow will update the field but it will also overwrite the first repeating table field.
- I need to know how to only update the most recent repeating table field and not the previous fields.

Since this is a form library I am unable to promote the InfoPath fields.

Any help would be appreciated.

Thanks

-Andy

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register
http://vadimtabakman.com/nintex-workflow-update-xml-part-2-updating-infopath-forms.aspx