Skip to main content


 

Symptoms


Workflow For Each loop event does not work for stored procedures
 

Diagnoses


Issue:
User has been trying to implement the new For Each event in a workflow to send emails to other users. They've done everything according to documentation here (https://www.k2.com/onlinehelp/k2blackpearl/userguide/current/webframe.html#For%20Each%20Event%20Wizard.html) and here (http://cyclops.nettrends.nl/blog/2015/10/k2s-4-6-11-for-each-wizard/) and, although the loop structure does work in that it sends emails for each of the records in the smartobject, the fields used in the email is a concatenation of all the other record's values for that field, for example, this is what the email is supposed to look like:

Email 1
Dear Alan

Email 2
Dear Bobby

Email 3
Dear Ryan

however they get the following:
Email 1
Dear AlanBobbyRyan

Email 2
Dear AlanBobbyRyan

Email 3
Dear AlanBobbyRyan
 

Resolution

Resolution:
Bug item has been logged and workaround has been supplied:
Edit the E-mail Event message body in the workflow.
Click on the ellipse to open the Context Brower.
Expand SmartObject Server(s) andgt SmartObect Server andgt SQL Server Service andgt gservice instance] andgt Stored Procedures andgt gdbo].oGetExpiringSamAccounts] andgt List method andgt double click on ?List?.
In the SmartObject Wizard, on the Filter window, click on Add.
Under ?Left? choose ID from the dropdown.
On the right in the Environment browser, click on the Process/Activity Data node (the middle one).
Expand Data Fields andgt VpnPwdResetReminder. Drag GetExpiringAccounts References2 Index2 into the ?Right? field.
Click Next, then choose a return property depending on what your requirements are. (in my case I chose GiverName).
Click next.
Click Finish and deploy the workflow again.

You should now be able to see mails such as:

Email 1
Dear Alan
Email 2
Dear Bobby
Email 3
Dear Ryan




 
Be the first to reply!

Reply