Passing data to a child process in an IPC

  • 31 March 2008
  • 6 replies
  • 1 view

Badge +3

Hi


I have looked around the forums and can't find anything that tells me this. Maybe it's too easy and everyone else already knows but I'm a complete newbie to K2 and struggling.


I have a workflow for purchase orders. The Purchase order lines are stored in a smart object with 4 fields aginst each line.


When the process is started I give it a purchase order number, the IPC then starts a child process for each row in the SmartObject that has the PO number given. This is a synchronous process using the 'plan per slot (no destinations)' option.


However I need to pass the child process the four values from the SmartObject about the partictilar PO Line that the child process is dealing with. I then need to call upon those values in a server event through c# code.


Any help much appreciated


Thanks in advance


Rich


6 replies

Badge +3

I hope I'm understanding what you're asking.  I assume you're using the second option "Select a list field to determine how many slots should be created."  When you do this, make sure to return the ID field of your order lines SmartObject.  You can then do one of two things on your IPC event Process Field Mapping:  1.  assign the Activity Destination Instance --> Instance Data (which should show up as ActivityInstanceDestinationData when you add it) to an ID field in your child process and then get your four fields from your SmartObject from within your child process or 2. assign your four fields from your SmartObject directly in your mapping.  I would lean towards the first option as I think it's cleaner.  Let me know if this helps.

Badge +3

Hi Paul, Thanks for your reply.


You're correct, I have used that option. However I am not using the ID field for the SmartObject because there may be many lines in the PO SmarObject for a single PO number and I want to create a new child process for each one. The ID field is an autonumber field to keep it unique.


Therefore I think I need to use the PO Number in this field in order to get the correct number of child processes started otherwise I will only get one child process run everytime.


Any idea how to get around this?

Badge +3

Rich,


I assume you have two SmartObjects:  one for the Purchase Order and one for the Purchase Order Lines.  In your Activity Destination, you should be using a List method of your Purchase Order Lines SmartObject.  You should filter this based upon the Purchase Order Id (which will create the correct number of slots - one for each Order Line) and return the Purchase Order Line Id.  When it creates each of its instances, it will then assign the Purchase Order Line Id to the ActivityInstanceDestInstanceData field which you can use to map to an Id datafield on your child process or whatever.  The key here is to get the Id for your Purchase Order Lines for each of your Activity Instances and then what you do with it is up to you.  Does that make sense?


 Paul

Badge +3

Hi Paul.


I only have the 1 SmartObject which has the PO Lines in it.


I do filter on the PO number and therefore get the right number of child processes.


You then say I should pass back the PO Line ID to my ActivityInstanceDestInstanceData field- How do I do this?


I have tried to write out the ActivityInstanceDestInstanceData field to the console in my child process and it is blank so I assume that I am not currently passing it anything.


The only place I am currently using the ActivityInstanceDestInstanceData field is in my IPC Events Field mapping where it is my parents field value and is being sent to a data field in the child process, is this correct?


Thanks for you time


Rich

Badge +3

So... I apologize.  It looks like I have been telling you the wrong field because of some other stuff I'm doing.  Try this...


In your destination rule for "Select a list field to determine how many slots should be created.", you should have something like this:  PurchaseOrderLines.GetList.Id


This ~should~ store the Id property into the IPCSourceFieldMappingName data field of the activity.  You can then map this field to your child process in the IPC Event Wizard.


I hope this works for you.

Badge +3
Have managed to sort this out now, Thanks for your help Paul

Reply