Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

InfoPath and adding new field to source

leave a comment »

Let’s say you created an InfoPath template based on some well defined XML document. You deployed your solution and it was working for a while without any issues. Now someone comes to you and ask to extend this template by adding one more field ! Unfortunately InfoPath do not support that :(. Of course you can add new field from the “Designer” but it would be added with InfoPath namespace with will not confirm to the source XML document (with let’s say is generated by external system). Happy there is a trick to overcome that.

Let’s start with explaining what we want to do. Bellow we have our current source :

image

what we want to do is to extend it by adding one more field under “ERPOrderItem” called “CompanyID”. Below our the steps with worked for me:

1. Go to File->Publish and use “Export Source Files” to save artifacts of your template in pointed folder. Once you do this you should get into your folder files like bellow:

image

(you can also get those files, by just changing extension of you YourInfoPathFile.xsn to YourInfoPathFile.cab and extracting all content from it)

2. Change “sampledata.xml” file by adding new element. In my case what I added you can see bellow:

image

3. Change “schema.xsd” file

image

4. Change “template.xml”

image

5. Done, now please open InfoPath Designer and open “manifest.xsf” file from the directory where you performed above changes. What you should get is:

image

Now save your form/publish it and enjoy 🙂

Advertisements

Written by Mariusz Gorzoch

21 December 2011 at 09:56

Posted in InfoPath 2010

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: