Monday, December 3, 2007

How to use web-enabled Infopath form with embedded code with K2 Blackpearl workflow

Microsoft Infopath web-enabled forms by default don't support Infopath code. But there is a way to enable that.

Follow this steps :
* Create a Infopath form aimed to be open in a browser
* Design your form (add the groups and fields, the data connections, etc.) BUT don't add .Net code now (it may work but that's not how I did it)
* Create your K2 project in VS 2005
* Design your workflow just like in the Infopath tutorial provided with the Blackpearl documentation until step 5; this step of the tutorial is the one where you must re-design the form to adapt it. Add your .net code now. When you're done, do not finish the Infopath Integration Wizard.
* In the Infopath Integration Wizard, edit the properties associated to your forms (ie "publish to") and set the form library where you'd like to see your form published. Select "content type" instead of "form library template", and do not forget to set the opening program as "web browser".
* Finish the wizard, and deploy your project
* Now go to the form library, the "settings", and delete all the content types set for this library.
* On the same site, click on "View all site content", you should see a "K2 Blackpearl Form Templates" or something like this. Open the lib. It contains the form you've just deployed. Right-click it, and copy shortcut to this XSN file.
* Go to your MOSS Central Administration, "Application Management" --> "Manage Form Templates", and click on "Upload a form template".
* Click the "Browse" button, paste the shortcut, and click "Ok". This file browser is not made to browse URLs, but it works. (before you paste the shortcut, it's better to choose desktop first to cause it works)
* Confirm the upload of this form template (you can verify it if you want, but it's quite useless)
* Activate it to your site collection
* Go back to your site, and to your form library
* Click "settings", and add an existing content type. In the list, you should find the name of your form (eg: "my form"), plus the name of your form with a suffix which should be "1" (eg: "my form1"). Select this one (the first one is the content type automatically deployed by Blackpearl, do not select it as it's not admin-approved)
* Now go back to the form lib, create a new instance of the form, and.......... it works!!!

This article was taken from this site

No comments: