InfoPath XMLWriter - Adding Rows in a Repeating Table That Contain a Boolean Field

Came across an issue today with an InfoPath form I am working on.

In the form there is a Repeating Table that contains within it both String and Boolean Fields.

In order to make the form prettier we have created custom buttons to add a row to the Repeating Table.  These button use an XMLWriter to add a new row.

For any new fields (String or Boolean) the writer does the following to create a blank Field:

writer.WriteElementString("fieldname", myNamespace, "");

The problem I had was that if you created Boolean fields like the line above, and then tried to Submit the form to SharePoint, you receive a validation error "Some rules were not applied.  InfoPath cannot submit the form"

Turns out the Boolean Fields were failing to validate with the empty string value.  

This was solved by putting in a value that isn't used in the form for the Boolean Field:

writer.WriteElementString("fieldname", myNamespace, "0");


Popular posts from this blog

Export Group Membership From Active Directory Using Power Query

HP Laserjet 1022 Printer - Can't Print on Windows 10

Power Query / BI - Data Refresh Error: The column 'Activities' of the table wasn't found