Looping Activity


Badge +10

Hi,

 

I would like to achiee the following in the worflow.

 

I have a smartobejct that returns a list of data. Now, in the workflow (KPRX), how can i loop through each list item and then send an email to a static email address and use the data returned in the list in the email.

 

So lets say my list returns 5 rows of SystemName, Status.

 

I want to go though each item and send an email to a static email address and say in each of the five emails, 

   Email 1 =  System A = Status Pending

   Email 2 =  System B = Status Complete

 

I do not want to send the whole list in one email. I want to send each item in a seperate email to the same email address.

I hope that explains what I am trying to achieve. Any help would be appreciated.

 

Now I have managed to make the activity loop on the number of rows returned by using no destinations and setting the slots to the number of rows returned by the smartobejct. I now need to somehow use the the data returned in each loop.

 

If not possible by just clicking, is it possible to do it in a code event.

 

Thanks 

 

 


3 replies

Badge +10

Hi S0m3one,


 


As you probably already know, loops are somewhat dangerous behavior to build into a workflow, specifically when they cannot be guarenteed to end.


 


With that out of the way, I think this KB article might do something like what you need.  I'd also like to mention that there are some new features in 4.6.9 that may assist here further, if that's the version you're on, I can look that information up for you.


 


http://help.k2.com/kb000685


 


Regards,


 


Mike

Badge +10

Hi,

 

If you are using plan per slot, no destination and you have an ID field dragged into the configuration then each ID will make its way into the ActivityInstanceDestination > Instance Data field.

In your Email you can call the Load method of that same smartobject, passing in the ID that can be found in the ActivityInstance Destination > Instance Data field as the ID input property.

That will then load the data from that smartobject and will only return the data for that one record which can be dragged into your email.

 

I hope this made sense.

 

Regards,

JohanL

Badge +10

Tow Excellent Ideas. Thank you all for your replies.

 

I did work out that the InstanceData seems to store the selected field at when creating the loop with no destination. But making that an Id and usign that Id to get the rest of the data is something I didnt think of. For my scenerio I've implemeneted this idea from your suggestions. Seems so straight forward now.

 

Again. Thanks for your help.

 

 

 

 

Reply