I have a small lesson learned as I did not listen to myself and use my own best practices for InfoPath integration with K2 in general. Basically I had some processes that were pretty simple using InfoPath. At certain points in the K2 Process I would kick out data to SQL using SmartObjects. A best practice is to make sure that you are kicking out that InfoPath data and not letting it sit as an XML document in a form library or in the K2 database because the data is not very accessible for enterprise reporting.
I had a change request to add some parallel processing to a process that was in production. The process had Security, VP, IT and Help Desk approvals that occurred in a serial manner. Now I needed to change the process by adding a Contracts approval that would occur in parallel with Security approval. It was simple enough to add a new Contracts approval activity and then add a new proceeding rule VP to make sure that both Contracts and Security finish before VP approval can begin. I ran into some issues with accessing the Outcome and Action Result activity level fields for both the Security and Contracts approvals. I would have liked to put into the proceeding rule that those values had to equal "approved" but they were not available in the wizard. The only option I had was to add some process level fields, add new events to the Security and Contracts activities, set the fields appropriately and then use the new fields in the VP proceeding rules.
The real issue I ran into was around working with the InfoPath data. The use case basically stated that if both Security and Contracts rejected I would need to resubmit back to each one independently. So if Contracts rejects; Security should still be allowed to approve. There is no guarantee that this would be done in a coordinated fashion and that both Security and Contracts approvers will be working with different portions of data.
The challenge was if both the Security and Contracts approvers rejected I would have some issues with the resubmission of data and ensuring data in the InfoPath forms is managed correctly. What I knew would happen is that lets say both Security and Contracts rejected, an InfoPath form would be generated for each resubmission activity for the originator. My InfoPath form was NOT loading off the database when it was opened. So if the originator opened up the Security rejection, changed some data, and then submitted. Subsequently the originator would then resubmit the Contracts rejection with different updated data. What would happen is the Contracts resubmission would overwrite on top of the Security resubmission edits because I was not loading the InfoPath form. It was clear as day I knew this was going to happen.
Solution, I need to modify the InfoPath form to load up off my SmartObjects. Luckily it is extremely simple to hook my SmartObjects into the InfoPath form and resolve this issue.
Lesson learned is just treat the InfoPath forms just like I would with an ASP.net form. When it opens use the rules to populate the form and then use submit rules to save form data using SmartObjects.