This blog post illustrates how to embed an image and text structure as a template for email notifications in a K2 workflow process, providing a more professional look and feel.
K2 Automated Testing Software
BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.
K2 provides the capability to generate email notifications out-of-the-box, but do not conform to a specific layout, structure or template thus providing total flexibility when it comes to producing dynamic content at runtime – the same as any other email provider like Microsoft Outlook does.
The components involved are:
- SharePoint picture library
- HTML template
- K2 workflow process
Create or download the desired image to embed in the email template as signature image.
This example makes use of SharePoint as document and general content storage medium that will host any images to be used in email signatures.
- Open the desired site collection in SharePoint and navigate to Site Contents.
- Create a picture library if none exists, as seen in the image below.
- Upload the desired image to the desired picture or alternative library in SharePoint to be used for
the email template, as seen in the image below.
HTML will be used to design and structure the layout and content for the email template, which can be used within the email notification event in K2 when constructing the workflow process.
- Create the template as desired, an example listed in the image as seen below.
K2 Workflow Process
Put it all together by creating a workflow process, by referencing the image from SharePoint and adding it to the template, after selecting to use the template when creating an email event to send out a notification.
- Create an example workflow process, as seen in the image below.
- The required data fields created are as follow:
- Sender Email
- Sender Office
- Sender Mobile
- Signature Image
- Signature Location
- The first data event is configured to point to the location of the image in SharePoint, as seen in the image below.
- The second data event is configured to embed the image as an HTML screen element, as seen in the image below.
- Last but not least, the email event is configured to use the template constructed previously and by including the data field containing the embedded image to complete the template content, as seen in the images below.
Email Notification Results
Next step is to save and deploy the process to the K2 server. As this example do not deploy the process to a specific integration medium like SharePoint, an instance can be generated from K2 Workspace.
These steps are listed below to generate some email template results.
- Open K2 Workspace and navigate to the desired process, as seen in the image below.
- Ensure the adequate process rights have been applied before attempting to test and kick-off the process.
- Kick-off the process by clicking on Start New.
- In the dialog Create new Process Instance, click on button Load Data Fields.
- Supply values for the data fields except for the two containing the location and image of the signature, as seen in the image below.
- The result of the email notification can be seen in the image below.