Mariusz, Gorzoch tech Blog

Archive for the ‘InfoPath 2010’ Category

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 :


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:


(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:


3. Change “schema.xsd” file


4. Change “template.xml”


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:


Now save your form/publish it and enjoy 🙂


Written by Mariusz Gorzoch

21 December 2011 at 09:56

Posted in InfoPath 2010

BizTalk 2010 and InfoPath integration

with one comment

Today I needed to build a solution where BizTalk will process some data and throw out a InfoPath form with details of processed message. I remember that in the past were I was doing that I used an orchestration and some construct/assign massage shape to achieve that, but today I decided to find if this is really the easiest possible way and guess what ! = this is the most complicated way.

In this post I decided to describe the simplest way I found and believe me it is worth reading if you used orchestration approach in the past. Lately I have an chance to work for a while with one smart person from Denmark, who shows me that BizTalk is done in the way that a lot of thinks can be done really easy (if you know what you are doing ;))

So, where we start:

1. Start by designing your InfoPath form.

Do this by simply grabbing your XML document (the one with is produced by BizTalk and you want to turn it on info InfoPath form). Simply start InfoPath and pick-up option to design your form from XML/XSD document. In my case I manage to design form like the one shown below (not really fancy one):


Once you finish, publish your template somewhere where everyone can access it.

2. Create instance of your document

Simply open your form and fill it with data. Once you do it, save this form to desktop and open it with “notepad”. The result in my case is shown below:


What we need from that file are the “Processing instructions” or information placed in the header witch are used by explorer (and all other kind of apps) to find out what program should be used to process that file. In my case this section looks like this:

name="urn:schemas-microsoft-com:office:infopath:BizTalkInfoPath:http—hempel-com-SDS-V100" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?>

Most of that staff is constant, but some like ‘”href” are not. Href is pointing to the place were you published you InfoPath template and it tells to InfoPath where he should look for it, when he is rendering your documents for the users.

Mark this entire “processing instruction” section and copy it to your clipboard, we goanna need it in a second.

3. Create send port of file type and “XmlTransmit” pipeline

Go to BizTalk to your favorite app and create a send port of type “File” and Pipeline = “XmlTransmit”:


and here goes a trick. Click on the “..” on the right side of the “Send pipeline”. This should open an window for you as shown below:


Option with are important for us are :

  • ProcessingInstructionOptions = 0 (0-append processing instruction, 1-create new)
  • ProcessingInstructionScope = 0 (0 – document, 1 – Envelope)
  • XmlAsmProcessingInstruction = here is a place where you should past your processing instructions

Once done, hit “OK” button and try to send document fallowing schema of the document you used to build InfoPath form. This should create an new file for you on the output folder, which you can click and see content in the InfoPath:

and once I click on it, the magic happens:


nice and simple

Written by Mariusz Gorzoch

16 May 2011 at 20:13