How to create a Workflow that loops through a specific ErrorProfile and sends notification mails containing Error Details.
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 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.