IPC Server Event

  • 17 July 2006
  • 9 replies
  • 0 views

Badge +3
I have read over almost every post but I seem to not be able to get the IPC server event configured correctly.

I have two processes. The first one has an InfoPath form hooked into it where the user can specify 1 to N users. I would then like to spawn sub-processes for each user specified.

I have read several things but with no luck. What I did do was for each user captured in the InfoPath's XML, I add a new destination to the activity in which the IPC server event is located within. This as expected creates the correct amount of sub-processes instances. So if the user enters three user names in the InfoPath form, three sub-process instances are created. Good.

Problem - In the sub-process, there is a different InfoPath form that needs to be filled out. In the example I stated, I want each of the three users to have thier own sub-process instance where they are assigned as the destination user. I am having problems setting the desintation user for the InfoPath activity in the sub-process to each of the users defined the parent process.

Please HELP.

Thanks,
Jason

9 replies

Badge +4
Create a process field in the IPC Process (sub-process) and store the name value of the person. Then use this process field in the destination rule of the InfoPath activity.

Hope this helps.
Badge +3
I do not completely understand.

Where do I set the child procss's process field you are suggest? In the parent process? If so how because I do not have specific code that is creating three different child instances. They are being created for free by me adding three destination users to the parent process activity with the IPC Server event. I understand how to send data out from the parent to the child process, but how can I send a specific value from a repeating structure into each of the dynamically created child processes?
Badge +4
What exactly do you want to achieve? I would suggest using XML if you have repeating structure. There are many ways to skin a cat ? You can determine who started the process instance by using the following code in a server event:


K2.ProcessInstance.Originator.Name.ToString()


In the DestinationRuleContext you can add destination users reading values out of XML.

C# Example:
.Value, "my:myXMLRoot/my:EmailElements"); 
For (int i = 0; i < xmlNodeList.Count; i++)
{
//Do something With the value of the element, maybe Append it To a String
emailText += xmlNodeList.Item(i).InnerXml;

//Add destinations
if (oDest1.IsSuccess == true) {
//== sendto
K2.Destinations.Add(DestinationType.User, emailText);

if (bAllTrue == false) return;
}
}


Hope this helps.
Badge +3
Sorry for not explaining myself well. Lets start over.

The Parent Process is started by an InfoPath form and in it I capture some XML like the following:

<Reviewers>
<Reviewer>domain/user1</Reviewer>
<Reviewer>domain/user2</Reviewer>
<Reviewer>domain/user3</Reviewer>
</Reviewers>

Then on the Parent Process the next activity has a IPC Server event. Because I have captured three reviewer names, I would like to create three Child Processes for each one of the reviewers. I already have code like what you gave me below to iterate of the XML and dynamically create three destination users on the Activity with the IPC Server event. I also have "Create a slot for each destination" checked on the activity. Because three destination users were added to the activity with the IPC Server event, three Child Process are created. I currently have it configured such that the originator of the Child Process is the K2 service account that we have.

On the Child Process I have a simple InfoPath process. On the InfoPath activity, I need to set the destination user for each one of the reviewers that were captured in the Parent Process. How do set the first Child Process instance to have user1 as the destination user for the InfoPath activity? And so on?

Where I am getting very confused is that I have not written any code to create the three dynamically created Child Process instances. They are being created because I have three destination users on the Parent Process's Activity with the IPC Server Event. So how do I map the first Child Process instance to the user1, the second to user2 and the third to user3?

Also - if there is a better way of doing this please advise. My goal is to again capture 1 to N users in Parent Process and then dynamically create Child Process instances for each one of the users captured.

Thanks,
Jason
Badge +3
Well, I have a solution.

On the Parent Process where the IPC Server event resides, I created a recursive call to the activity with the IPC Server event. With each loop through I set the reviewer name to a process level variable. I then pass that process level variable do to each child process that is created. Then that is used to dynamically set the destination in the child process instance.

Jason
Badge +4
Cool, :D

David
Badge +5
I have a question about this: "On the Parent Process where the IPC Server event resides, I created a recursive call to the activity with the IPC Server event"

How do you do this ?
Badge +9
I'm unclear as to your intentions.  Is this still an issue?  If so, could you please explain further.  Thx.
Badge

Hi,

Could you please be clear about the way to create a recursive call to the activity with the IPC Server event?

 Thanks for your help!

 


 

Reply