Saturday, July 18, 2015

Emails in a K2 workflow stopped working after deploying new workflow version.

The workflow fails while trying to send a notification with the error "SourceCode.Workflow.Common.EWS: The e-mail address does not have ‘send on behalf of’ permissions on Exchange".


  1. Check if SMTP server, Exchange server connection strings are correct in “ConnectionStringEditor.exe”
  2. Open Connection String editor from "C:\Program Files (x86)\K2 blackpearl\Host Server\Bin" as Administrator.





  1. Check if Email "From Address" field value is a valid email in Environment Fields/String Table and same as the email displayed in the connection String editor.
  2. Restart IIS, MSMQ and K2 services.

Get Emails for Multiple Destination Users in K2 Workflow

In Workflows, sometime we may need to get emails for dynamic destination users (one or more destination users separated by semi-colon ’;’).
To achieve this, we need to do as follows:

  1. Add two Process Data Fields, one for storing User IDs and another for getting User emails.

  1. MultiUserIDs – Process field to store semi-colon(;) separated list of User IDs
Ex: k2:denallix\administrator;k2:denallix\bob.
Note: you can also pass  data without K2 label,
Ex: denallix\administrator;denallix\bob


  1. MultiUserEmails – Process field to fetch and store semi-colon(;) separated list of User Email Ids for the input User IDs.

  1. Add a default Activity. Configure the destination rules as follows:

  1. Run the Destination Wizard in “Advanced Mode”


  1. Select “All at Once”


  1. Select “Create a slot for each destination” and “Resolve all roles and groups to users”


  1. In the Destination Sets, Add New Destination with Split function as follows:

  1. Click on “Finish” button

  1. Add the event, “Default Server Event(Code)” to the above activity.

  1. Go to the code event by,

  1. Add the following Code for the code event. This code will loop through the destination users and get emails for the multiple destination users and concatenate them with semi-colon(;).

  1. That’s it. After that, you can add an email event with “MultiDestEmails” as “To field’ to send emails to all destination Users.

  1. Once you run this, you will get the Output as follows: