ActivityDestinationInstance Query...


Badge +9

I am having trouble getting my head around what actually happens with each instance of an infopath form in a process, and the what instances of a form are created within a process. I would appreciate any assistance in working this out.

Firstly, I am using an infopath form within a process to collect information.
Am I correct in my understanding that the following occurs:
There is an instance of the form held within the PROCESS (the ProcessInstance)
When an activity is created, then another instance (ActivityDestinationInstance) of the form is created, and used within this activity.
When the activity completes, then the ActivityDestinationInstance is copied from the activity, and overwrites the ProcessInstance.

Based on this, could someone give me an idea of the best way to approach the following problem:

The infopath form that I have can be sent to multiple destination users. Each destination user can select a status, and add comments. I would like to add the status and comments to a repeating table in the infopath form (using code in K2), so that a full history can be viewed on the form at any stage.
If I alter the ActivityDestinationInstance version of the form using K2 code to add the coments and status selected, and there are multiple destination users, won't the forms that are completed last keep overwriting the data from the previous destination users?
eg 2 destination users for the activity, user A and user B. Planning for the activity is "Plan Per Destination" "All At Once", so each destination user should receive the task at the same time, and there is a slot for each destination.
The activity is started. A Task is assigned to User A and user B (this also creates a separate instance of the form for each user)
user A completes the form, and selects "Approved" and adds comments. When A completes the task, I have some server code that runs to add the status and any comments to a repeating table in the ActivityDestinationInstance version of the form.
User B then completes their task, and selects "Changes Required". The server code runs again to add the history to the ActivityDestinationInstance version of the form.

Which instance of the form will then be copied back into the ProcessInstance of the form? Does User B's form become the version that is put back into the ProcessInstance?

If so, what is the best approach that allows me to preserve the history from both destination users?

Hopefully this is clear enough (my head certainly isn't). If you need any further information, please let me know. I would really appreciate someone helping me to clear this up.

Thanks in advance!!



2 replies

Badge +9
I would suggest using smart objects to persist the data to the smart box on submit of the InfoPath form, and have the InfoPath form read the data from the same smart object when it opens.  I can give you more details on this if you like, but it will hopefully put you in the right direction.  Good luck!
Badge +9

Thanks very much for getting back to me.

I will have to look into the smart objects option for my next project - I haven't really managed to get my head around Smartobjects, and didn't have enough time to experiment on this project.

I managed to achieve what I wanted to do by writing to a process level field after each destination user completed the task - after the activity was completed, I then had an additional activity which read the data from the process level field and added it to the infopath form. The result is a few additional activities, however it does do exactly what I wanted to do.

Thanks again for getting back to me - I really appreciate you taking the time to reply!

Reply