Solved

Accessing Infopath rules without opening Infopath form

Posted on 2008-09-30
6
1,051 Views
Last Modified: 2010-05-18
This just may not be possible, but thought I would throw it out there:

The base question:  Is there a way to execute Infopath rules without actually opening up an Infopath form with the Infopath client?  I don't believe there are Infopath APIs to be called from .NET code but maybe I'm wrong or is there some other way to access the rules "virturally" within code.  

Background:  I work for a company that has workflow software where we can update an Infopath form with data captured within our system and we're using the Infopath form as the user interface.  We only want the user to get the Infopath form if there are errors present, otherwise send the form on to the next steps in the workflow.

We're using an Infopath 2007 form which will be published to a MOSS document library.  Using an XML doc created by opening the form and saving it without adding any data, we will then add  data.  From there we need to validate the data using the rules created within Infopath.  We know we can capture the number of validation errors to store on a field on the form to use later, but it requires quickly opening and closing the form programmatically (the rules execute on open).  Our worry is that there could be hundreds of forms opening and closing which could hog server resources and create other errors as we do this.  Ideally if there was a way to access the error count through .NET code, we wouldn't have to worry about opening and closing the form.  

Any ideas or are we just dreaming?? Thanks.
0
Comment
Question by:TicketKev
  • 2
  • 2
  • 2
6 Comments
 
LVL 28

Expert Comment

by:clayfox
ID: 22607620
You can open, and submit forms via code.

Research some of the command line options but deffinetly you could automate this with windows script host.
I have used a vb routine to automatically open a form while passing in data from a db and then the submit emailled it to the user info passed in. I beleive you can accomplish what you need to automate.

www.infopathdev.com should help.
0
 

Author Comment

by:TicketKev
ID: 22607700
clayfox - Thanks for your reply.  I know I can automate opening and closing the form via code, but what I need is some way to open it, get the error count with data, and close it but WITHOUT actually opening and thus firing off the Infopath client.  I guess I"m looking for a way to tap into the XSN file without the overhead of running the Infopath client.  
0
 

Author Comment

by:TicketKev
ID: 22607730
clayfox - Another question for you:  In your vb routine to open and close the form, what type of volume did it handle?  Did you experience any issues?  If we can open and close Infopath several times in a minute without anything coming back to bite us, we would feel better about just going that route.  Thanks.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 28

Expert Comment

by:clayfox
ID: 22611568
Your other option is to process the xml directly, replicate the logic from the form.

I had mine run once through about 1 thousand forms but did not monitor the performance.  I would think if you had the process run on submit that even with 2k users you are not going to have many simultaneous forms.
0
 
LVL 1

Accepted Solution

by:
hstaples53 earned 500 total points
ID: 22682533
Here's a couple of ideas; either way you're basically having Infopath run in some context (whether it be an ASP.NET page or an EXE)

1) Server-side call to Infopath Forms Services

You'll still need to open the form and have the rules processed through Infopath, but I'd run the forms through Infopath Forms Services so it's done in something that's made to handle opening a bunch of forms at the same time.

To get Forms Services working for you:
* If you have MOSS Enterprise installed, then click Site Settings, Site Features, and make sure the SP Enterprise Features are activated. That'll give you Forms Services.
* Make sure your Infopath Forms is able to run in the browser. Open the form in Design Mode, click Tools | Form Options then click  Compatibility on the left and click the checkbox that says "Design a form template that can be opened in a browser or Infopath" and do a verify. After that is done, republish your form.

So, now you have a form that can run in the browser. I'm not exactly sure what the 3rd party workflow software is that you're talking about, so I'm not exactly sure what all it can do. I'd suggest reading up on the Infopath Forms Services SDK (http://msdn.microsoft.com/en-us/library/ms772301.aspx) and seeing if something there turns on the lightbulb for you. My guess is that you may want to just pass a URL to open the form in the browser and then save it. That may be all you need to do.

The reason I suggest going down this path is that, while I'm sure there's some way to do it, I'm not sure there's a good way to kick-off the Infopath rule processing without having Infopath open.

2) Build an EXE that uses the Infopath control.
Not exactly sure what your 3rd party software is, but the key thing is that you're going to need to reference the DLL located at C:\Program Files\Microsoft Office\Office12\Microsoft.Office.Infopath.FormControl.dll. At that point, you can then write code to instantiate a form control which will then host the running infopath form. Doc'n on calling that is at C:\Program Files\Microsoft Office\Office12\Microsoft.Office.Infopath.FormControl.dll

If you're serious about Infopath development, there's a 1200-page book "Designing Forms for Microsoft Office InfoPath and Forms Services 2007" which goes through a coding example of this (I keep it on my safari.oreilly.com bookshelf for reference).

Anyways, the reason I suggest either of the above two methods is that I think you're going to have to have Infopath running for the rules to get picked up on the form. The main reason is that the .xml file that holds your Infopath data doesn't have the rules in it; it's just an xml file of the data that has a reference at the top of it to the .xsn that was used to create the form. So, now, that .xsn is really just a collection of files, most importantly there's manifest.xsf which at the bottom of it will have two sections describing your rules and validations that have been created. I think it would be an exercise in frustration and limitation to try and create something that opens the .xml, then the .xsn, the the .xsf, then iterates through the rules and tries to figure out the errors.

Good luck, hope that helps.
0
 
LVL 1

Expert Comment

by:hstaples53
ID: 22682545
Soprry the documentation on creating a hosted FormControl in an EXE is at
http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.formcontrol(VS.80).aspx 
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Last week I faced a strange issue recently, i have deployed SharePoint 2003 servers for one project and one of the requirements was to open SharePoint site from same server. when i was trying to open site from the same server i was getting authentic…
Before you can digitally sign infopath forms, you must have a digital certificate. Microsoft Certificate Services will need to be enabled on a Windows Server 2008 to facilitate the creation and verification of the digital certifciates on the web ser…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question