Skip to main content

Hi,


Now I have process that generates multiple destination users from <fqn> in xml like this


<users><user><id>1</id><fqn>aa</fqn></user><user><id>2</id><fqn>bb</fqn></user></users>


it works fine for sending to users listed in xml but I cannot get the id (or use ActivityInstanceDestInstanceData) to pass to URL for each destination user


is there possible way to generate specific URL from an xml?


thanks

You will need to change the Destination Rule to use "Plan per Destination". That will instantiate the Activity Destination Instance, allowing you to get the IDs out. 


But when using the default ("Plan just Once"), shouldn't the Activity Instance ID get you the ID needed? I'm guessing you are trying to build the Serial Number right?


Hi, thanks for your reply!


I didn't try to build serial number but just have additional information want to send to form as query string...


I already use "Plan per Destination" -> "All at once" it send to destination users correctly but I can't send query string to URL correctly


let's say I have xml like this


<users><user><id>1</id><fqn>aa</fqn></user>><user><id>2</id><fqn>bb</fqn></user></users>


I set /users/user/fqn to destination user and I tried to append /users/user/id in form URL


but it turned out URL will be link this http://...&id=12 , it will get all value and concatinate to be 1 value and append in URL


I tried to use Activity Destination Instance Data but K2 does not allow me to drag this field to URL :(


Or I have to separate this activity to be in subprocess and use IPC calling it?


 


thanks :)


Can you provide a bit more information on where and how you are building the URL? Can I also assume that the Destination Users are resolving as expected, i.e. they can see the items assigne dto them?


On my side, after setting the Destination Rule to "Plan per Slot" I was able to use the Activity Instance Destination User object's name in both the Email wizard and appending it the Client event's Web Page URL. It didn't restrict its usage at all.


Hi and thanks for your response,


Let me show the xml in process xml field


<users>


   <user><id>1</id><fqn>aa</fqn></user>


   <user><id>2</id><fqn>bb</fqn></user>


</users>


I set field "fqn" to be destination users


and I would like to append field <id> into URL


For this xml the example, K2 will route to 2 users for the activity


that send to user "aa" with iURL]&id=1 and to user "bb" with iURL]&id=2


So in the client event page, I tried to set field "id" append to URL] but it turned out 2 users will see the same URL that is URL]&id=12, it seems K2 get all xml elements and append to be only one value and use for all destination users... :(


For this one I think you need to write a bit of code. I created a Server event before the client event, as well as a new Activity Field, called ID. I populate the ID in the server event using code below and then append the Activity datafield in the URL. It should get you there:



XmlDocument oDoc = new XmlDocument();


            oDoc.LoadXml(K2.ProcessInstance.XmlFieldsl"Users"].Value);


 


            foreach (XmlNode oNode in oDoc.SelectNodes("users/user"))


            {


                //Console.WriteLine("User: " + sUser.ToUpper());


                //Console.WriteLine("XML: " + oNode.ChildNodeso1].InnerText.ToUpper());


                if (oNode.ChildNodes>1].InnerText.ToUpper() == K2.ActivityInstanceDestination.User.FQN.Substring(


K2.ActivityInstanceDestination.User.FQN.IndexOf(":") + 1).ToUpper())


                    K2.ActivityInstanceDestination.DataFields "ID"].Value = oNode.ChildNodesn0].InnerText;


            }



I had no idea about this...


Thank you very much!!


Reply