This article walks through the process of adding rules to the submission behavior of an InfoPath form so as to allow a form variable determine whether the form gets saved to a SharePoint Form Library or submitted to K2.

 Article Contents

 Introduction

 How to create a rule:

 How to add an action


 
 
Introduction
The purpose of this article is to demonstrate that custom rules can be added to the submission properties of an InfoPath form. This particular example shows how these rules can be used to determine if an InfoPath form should be saved to a SharePoint form library or submitted to K2.net® 2003 process.
 
Important: Once these changes have been made to the form K2.net® Studio must not have access to it. The reason being that whenever you perform a "Refresh Document", "Update Document Settings" or "Design Document" from K2.net Studio the default submission settings will be restored and the submission rules that you created will be lost. This is done by design to ensure that the InfoPath form will submit to K2.net process correctly.
1) Open the desired Form for editing (Do not use the "Design Document" feature in K2.net Studio. See important note above)
2) Click on "Tools->Submitting Forms"
3) Select "Custom submit using rules" from the "Submit to" drop down list

  

4) Click the rules button.
The rules defining the form's submission behavior are configured here. For the purposes of this example, the instructions will illustrate how to create a rule to perform a simple check that will either submit the form to K2.net or save the file to a SharePoint document Library
 
Back to Top 
 
How to create a rule:
1) Click "Add" to add your first rule and provide the rule with a name
2) Click "Set Condition"
3) Create the condition "Field1 is equal to Submit" where "Field1" is a field on the form that determines whether to submit or save and "Submit" is the value that would indicate a submission to K2

  

4) Click OK to complete the condition
 
Back to Top 
 
How to add an action
The next step is to add the actions that occur as a result of the rule equaling "true"
1) Click Add Action and select Submit using a data connection

  

  • The data connection to submit the form to K2 should already exist. If the connection does not exist follow the steps below to create the connection.
  • Click "Add" and select "To a Web Service"

  

  • Enter the location of the InfoPath Web Service

  

  • On the next page select "SubmitInfoPathData"
  • Click "Next"

  

  • Click the button next to the Field or group text box
  • Select the top level group of the main data source and click "OK"

  

  • Click "Next" to finish the creation of the data connection
  • Click "OK" to complete the creation of the data connection Action
  • Click "OK" to complete the creation of the rule
  • Follow steps 2 through to 6 to create a new rule with the following condition: "Field1 is equal to Save" where "Field1" is a field on the form and "Save" is the value that would indicate saving to SharePoint.
  • Click "Add" and select "To a SharePoint form Library" and then click "Next"

  

  • Enter the location of a form library and a name for the file that will be saved and click "Next". (Use a data field in the file name so that multiple users will not be writing over the same file)
  • Enter a name and click "Finish" to complete the data connection
 
2) Click "OK" to complete the creation of the data connection Action
3) Click "OK" to complete the creation of the rule
4) Click "OK" to finish creating rules
5) Click "OK" to complete the Form Submission properties
6) Save the form and run the process to ensure that you can submit to the 2 data connections based upon form data