This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
How to create a Workflow that loops through a specific ErrorProfile and sends notification mails containing Error Details.
Before You Begin
The aim of this article is to guide a developer on how to create a workflow that will loop through a specific error profile’s errors and generate a mil for each error found.
To get this to work you will have to make use of K2 Management SmartObjects (GetErrorLogdFiltered) and this means the executing user aka the service account, will need K2 Server Administrator rights. OOTB this will already be granted.
This scenario also will require a product fix to work, the fix needed shipped in K2 Cloud Update 5 FP7 and K2 Five 5.1 FP21
This scenario is: loop through all errors in the error log and send an email for each error.
- Create an advanced SMO
- Use this list method for your advanced SMO
- K2 Management > Workflow > Management > ManagementService > GetErrorLogsFiltered
- Complete the Add Method wizard
- Create your workflow
- Drop a loop step
- Put the loop into dynamic mode (click on the pencil)
- Go To SmartObjects in the context browser
- Go to the SMO you just created and select ID property
- Select all items as a collection from the drop-down
- ErrorProfileID = YOUR SPECIFIC ERROR PROFILE ID
- Extend the next item part of your loop
- Add your SMO to the loop
- Method = List
- Identifier = ID
- Filter on ID and select your Items Value from references
- Select map to data fields and add ID and description
- Create two new variables ID (number type) and Description (text type) and map the outputs to them
- Next add an email event to your loop
- Subject: Test mail
- Body: Drop you ID and description variables
- Complete the loop.