Hi, Aravindhan Rajagopal here. I am a developer on the Information Security Tools team.
This post continues form my previous blog (Part 1 here) on InfoPath form submission to SharePoint...Lets go through the web service creation and form submission methods specific to the scenario where custom codes inbuilt in an InfoPath form does not work in an organization.
Web Service Creation:
As we know, InfoPath forms are nothing but xmls. So each and every InfoPath forms submitted in email can be saved as an XML from outlook. So you can go through the xmls that gets generated for each type of form submission and come up with a web service methods real quick. I felt that this method would help you cover almost all the real time scenarios and options that the customers would do while submitting and hence the resulting xmls - that you should cover in your web service. Not to forget the xml namespace consideration in the web service code.
Please Note: This method would come handy in case your InfoPath form contains repeatable sections. I have seen many InfoPath forms that were constructed using copy/paste of controls from one place to the other. This would result in an ill formed xml, making it tricky to be considered for a web service call. The above email –> save as xml –> for all the form submit options would help you create a clean InfoPath form.
Assume that the InfoPath designer copy pasted the controls between repeatable sections - which is quite common during creation of InfoPath forms.
The xml might end up like below, if the designer has copy pasted the router section controls from server section controls in the InfoPath form.
<my:opt_formBody> <my:radioOption>2</my:radioOption> <my:ServerRequestSection> <my:textRequestor>john</my:textRequestor> <my:textAlias>johnabc</my:textAlias> <my:textTeamName>Infosec Team</my:textTeamName> <my:textServerName>XYZ Router Name</my:textServerName> <<--- Router name filled under server name <my:richtextComments>This is test data</my:richtextComments> </my:ServerRequestSection> <my:RouterRequestSection> <<---This is the section which was originally filled up by the customer </my:RouterRequestSection> </my:opt_formBody>
You might understand how it would be if the router name is assigned to a server 🙂 The original intended xml should be like below
<my:textRouterName>XYZ Router Name</my:textRouterName>
<my:richtextComments>This is test data</my:richtextComments>
The custom action (request logging and tracking in our case) can be implemented in the web service code in its appropriate method pertaining to each of the forms. I think I need not go through that section in detail as it may not fit your requirement
Lastly, instead of having the customer go to individual form library and hit a new item button (please refer to MSDN articles on how to publish an InfoPath template to a SharePoint library), we shall list all the forms in a single page in the team site. To accomplish this, we may publish the templates to form libraries (either individual or multiple) and refer to the template form in the customer facing page like below
<%@ Page Language="C#" %> <html dir="ltr"> <head runat="server"> <META name="WebPartPageExpansion" content="full"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Customer Engagement Forms</title> </head> <body> <form id="form1" runat="server"> <a href="../ServerEngagement/Forms/template.xsn">Server Request</a> <br> <a href="../RouterEngagement/Forms/template.xsn">Router Request</a> <br> <a href="../AccessRequest/Forms/template.xsn">Access Request</a> </form> </body>
Please leave comments in case you need any particular topic discussed above needs to be elaborated.