Introduction

Special consideration is required when using single Microsoft InfoPath documents in multiple workflow processes. This document explains the design considerations required to successfully implement the same InfoPath workflow solution (which in this document, uses a single form with multiple views) into two different processes.
Note: This document assumes that the user is familiar with setting multiple views and rules using Microsoft InfoPath.
Tip: The user may choose to view current document status and document update details, as well as deploy processes, via K2 Studio or K2 for Visual Studio.

Infopath Implementation Example

Below is a basic scenario that uses the same InfoPath document within two different workflow processes.

Process 1 - The Parent Process

The parent process will be started normally, using a typical InfoPath view. Once the basic approval cycle has been completed, an IPC event will be used to start the child process in order to continue the overall approval process.

To keep it simple, standard naming conventions will be used for Client activities and InfoPath views. For example:

Activity Name
InfoPath View Name
Approval - View 1 View 1
Approval - View 2 View 2
Approval - View 3 View 3
Approval - View 4 View 4

'Parent' process design:



Deploying the Parent process will insert the following set of rules into the InfoPath document:





After the process has been deployed, the rules can be viewed in the InfoPath form template (design mode). This is done by clicking the Design button on the Workflow Form Templates page of the InfoPath Integration wizard. The rules allow multiple activities to use different views within a single form template.

Process 2 - The Child Process

'Child' process design:





Deploying the Child process will insert the following set of rules into the InfoPath document:




Note that the rules which apply to the Parent process have been removed and replaced by the rule set above, which applies to the Child process. This is expected behavior. Only rules that contain the phrase ‘Set Workflow Task Action’ as part of a rule name will be removed and replaced by the current process configuration. Custom rules will not be changed or removed.

Redeploying the Parent process will remove the rules above, and replace them with the rule set shown in Figure 2.

Design Considerations

Next, confirm that the InfoPath document has been published and includes all the required rules:

  1. Open the InfoPath Integration process wizard properties.
  2. Compare the file location details for the Parent process and Child process. Both processes must be present within the same K2 project.
  3. Integrate the InfoPath document with the Parent process as normal.
  4. To integrate the InfoPath document with the second (Child) process, make sure that the InfoPath Integration wizard is open. In the InfoPath Form Source Location window, select the Project System option from the Located at dropdown list:

    Image
    The Parent and Child processes should now reference the same form template. This means that Parent and Child process settings should appear identical, as in the figures below:
    'Parent' Process Settings:

    Image


    'Child' Process Settings:

    Image

  5. Launch K2 Studio or K2 for Visual Studio.
  6. Compare the *.XML Field names for the Parent and Child processes within the Object Browser. The *.XML fields for both processes should have the same name (SampleSolution in the figure below):

        Parent Process Settings:

        Child Process Settings:

               
  7. Using two separate columns, list the views which were used in the two processes.
  8. Use these columns to identify the views that were used in both the Parent and Child processes, as well as the views used in the Child process only (In the figure below, view 2 is being used by both the Parent and Child processes, and view 4 is being used by the Child process only):
    Parent Process
    Child Process
    View 1 View 2
    View 2 View 4
    View 3  

    Note: Based on the example above, because View 4 is being used by the Child process only, we can see that the rule which contains View 4 will be lost once the Parent process is deployed.
    Note: View 2 is a common View that is used by both processes. To insure that the rule representing this view is configured correctly, the same XML Element should be used in the document representing the Action field.
  9. Configure the Child Process. This will update the InfoPath document with all settings required for the actions and rules to work properly. It will also change the corresponding controls to dropdown lists.
  10. Since View 4 is used in the Child process but not the Parent process, the associated rule will be removed as part of configuration of the Parent process. To make sure that the rules are not removed, follow the steps below:

    Step 1: Run the InfoPath Integration wizard a second time. To open the InfoPath template in design mode, click the Design button on the Workflow Form Templates page:



    Step 2: From the Tools menu, select Submit Options and then click the Rules button. Verify that the controls representing the Action on the Child process views have been updated, and have changed to dropdown lists.

    Step 3: Save and Close the InfoPath document.If the workflow is opened using K2 Studio or K2 for Visual Studio, a message will be displayed stating that the document has been updated.
  11. For the Parent process, follow the steps below:

    Step 1: Run the InfoPath Integration wizard a third time. To open the InfoPath template in design mode, click the Design button on the Workflow Form Templates page:



    Step 2: From the Tools menu, select Submit Options and then click the Rules button. Notice that the existing rules correspond to the views used in the Child process. From the list of views used in the table which was created earlier, identify the views which are not being used by the Parent process.

    Step 3: To ensure that no rules are removed, rename the rules. As an example, rename ‘Set Workflow Task Action 4’ to ‘Child process view 4’.

    Step 4: Repeat the above step for any additional views which have been identified.

    Step 5: Close the Rules dialog, and save the document before closing InfoPath. If the workflow is opened using K2 Studio or K2 for Visual Studio, a message will be displayed, stating that the document has been updated.

    Step 6: To verify that the correct rules have been inserted into the InfoPath document before the process is deployed, open the file system location of the document using Windows Explorer. Right click on the InfoPath document, and select Design. From the Tools menu, click Submit Options, then click the Rules button.

    Step 7: Review the rules as displayed in the dialog. Verify that each View used in the solution has a corresponding rule. Note that ‘Child Process View 4’ has not been removed as part of configuration of the Parent Process:


    Note: All rules containing the phrase ‘Set Workflow Task Action’ will be replaced during the configuration, but renaming these rules will ensure that they are not replaced.
    Step 8: If all the needed rules are present, close the InfoPath document. Deploy both processes in K2 Studio or K2 for Visual Studio. Finally, exclude the Child process and deploy only the Parent process in K2 Studio or K2 for Visual Studio.
  12. Create a new process instance, and test the solution.
Note: Because existing process instances will not be affected by the changes, a new process instance must be created before testing.