I would like to refer to the topic http://forum.k2workflow.com/viewtopic.php?t=797 which desrcibes also my problem.
I would like to generate several slots for an activity with a InfoPath form. Each user who recieves a task may put in his/her decission and comments on a InfoPath form - two text fields in a repeating group on a form. I would like to collect all the data after all the slots are completed and on the another InfoPath view present them in a repeating table.
Presently, after the succeeding is finished, process data include only activity data from the last submited destination.
Could someone give precise guidelines how to resolve this problem? Does it need to modify code for CopyActInstDataToProcData procedure in an activity succeeding rule?
Page 1 / 1
Hi,
I make the following assumptions:
- My InfoPath document contains a repeating section that looks similar to the following sample
- My process contains a XML Field that matches the repeating section in the InfoPath document
Step 1: Add a Server Event after the InfoPath client event.
Step 2: Open the code window, copy the comments made by User 1 from the InfoPath document to the Process XML
Step 3: In the next Activity, copy the repeating process XML to the InfoPath document stored on process level
Step 4: Test the process
Please Note: I have not tested the code sample, so you might need to play a little bit with XPaths used
I make the following assumptions:
- My InfoPath document contains a repeating section that looks similar to the following sample
<Comments>
<comment>
<User></User>
<Result></Result>
<Comment></Comment>
</comment>
</Comments>
- My process contains a XML Field that matches the repeating section in the InfoPath document
Step 1: Add a Server Event after the InfoPath client event.
Step 2: Open the code window, copy the comments made by User 1 from the InfoPath document to the Process XML
Sub Main(K2 as ServerEventContext)
Dim SourceField as Object
Dim TargetField as Object
SourceField = SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(K2.ActivityInstanceDestination.XmlFields("InfoPathDocument").Value,"Comments/comment")
TargetField = SourceField
If K2.ProcessInstance.XmlFields("TempXML").Value = "" then
If K2.ProcessInstance.XmlFields("TempXML").MetaData <> "" then
K2.ProcessInstance.XmlFields("TempXML").Value = K2.ProcessInstance.XmlFields("TempXML").MetaData
End If
End If
K2.ProcessInstance.XmlFields("TempXML").Value = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(K2.ProcessInstance.XmlFields("TempXML").Value, "Comments", TargetField)
K2.Synchronous = True
End Sub
Step 3: In the next Activity, copy the repeating process XML to the InfoPath document stored on process level
Step 4: Test the process
Please Note: I have not tested the code sample, so you might need to play a little bit with XPaths used
Rénier:Hi,
I make the following assumptions:
- My InfoPath document contains a repeating section that looks similar to the following sample<Comments>
<comment>
<User></User>
<Result></Result>
<Comment></Comment>
</comment>
</Comments>
- My process contains a XML Field that matches the repeating section in the InfoPath document
Is this the process XML that has been created by the infopath event, or an XML field that you have created in the process?
Rénier:
Step 1: Add a Server Event after the InfoPath client event.
Step 2: Open the code window, copy the comments made by User 1 from the InfoPath document to the Process XMLSub Main(K2 as ServerEventContext)
Dim SourceField as Object
Dim TargetField as Object
SourceField = SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(K2.ActivityInstanceDestination.XmlFields("InfoPathDocument").Value,"Comments/comment")
TargetField = SourceField
If K2.ProcessInstance.XmlFields("TempXML").Value = "" then
If K2.ProcessInstance.XmlFields("TempXML").MetaData <> "" then
K2.ProcessInstance.XmlFields("TempXML").Value = K2.ProcessInstance.XmlFields("TempXML").MetaData
End If
End If
K2.ProcessInstance.XmlFields("TempXML").Value = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(K2.ProcessInstance.XmlFields("TempXML").Value, "Comments", TargetField)
K2.Synchronous = True
End Sub
Step 3: In the next Activity, copy the repeating process XML to the InfoPath document stored on process level
Step 4: Test the process
Is the next activity an Infopath activity? If it is, when the activity is opened isn't the infopath form stored on the activity instance, and won't it overwrite the changes to the process level infopath?
I am trying to do the same thing. I can get results from multple users or get the process to loop through a repeating node but not both .
Did the code work?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.