With K2, there is (most likely) the need to create a user task – ie. a client event of some kind – using InfoPath, ASP.NET, etc.
And – all you have to do is tick a box and an email will automatically be sent to the user when the task (client event) is created.
When the user task happens, the user will then get an email looking like this :
But – if you need to (or want to) CHANGE the look and feel of the email template – how can I does this ?? Well, I’m glad you asked…>
Deep (deep) within the bowels of the K2 “Program Files” folder, there are a number of EXE’s and CONFIG files – and there’s also a file called… (take a deep breath !) :
The file location is :
C:\Program Files\K2 blackpearl\Host Server\Bin\
This file contains the HTML definition of what that email looks like (above). And so – you can use your favourite HTML editor to change it all about – I just fiddle away in Visual Studio – the one tool of choice for me…
Quick tip – append a “.HTML” extension and will then have a proper editing experience in Visual Studio – colour coded & preview – just need to fix up some XHTML.
And – make sure you remember to remove the “.HTML” when you’re completed.
Here’s one I’ve prepared for the “DENALLIX” corporation (seen in Visual Studio) :
IMPORTANT – be sure you take a backup copy of the file – and you MUST retain the value within the text : [UrlWithSN] This is replaced with the URL to the client event page – ie. an ASPX / Forms Server page.
After saving the file in place with the new layout & so forth – all is done for the template.
Time to give it a whirl.
- So – users should see this new layout from now on, right ?? WRONG…
- Just a simple re-start of the K2 Server should pick it up, eh ?? WRONG…
- Re-boot the server (Windows & all) – should pick it up, eh ?? WRONG…
Jeez – what do I have to do to use my new mail template !!??!
In fact – this mail template is only loaded when a new client event is created in Visual Studio.
So – any NEW processes that are developed – and deployed – will have the correct mail format.
BUT – not any process instances that already are underway – or for any new instances of an already deployed process definition.
To demonstrate the concept, I’ll create a new process (very simple) – and we’ll worry about the OTHER process mail templates a bit later (read more below).
- Add a “Default Client Event” – just put something like http://www.abcdefg.com for the address – who cares, just want an email to come through.
- Just need the default action (“Task Completed”)
- Add a “Default Server Event (Code)” – and add in a line to complete (as above)
- Deploy the process
- Jump over to K2 Workspace, and start up a new instance.
Then – should get an email arrive – just like this :
That looks great, eh ? Being HTML, you can configure anything really – including STYLE, height, layout – anything really !
This is definitely something that you should do BEFORE creating any new K2 processes – but there’s a really clever (MacGuyver) trick for “refreshing” the existing processes that you’ve deployed.
Meaning that you don’t have to re-edit / re-deploy them all – and any currently running instances will get the fancy new email template / layout.
This involves either of the following :
- Use the K2 Workspace to view the email “Notification Event” to change what the format of the email will be. This is a “manual” step – and has to be done one-by-one – I had over 80 listed on my K2 Server – and so I wanted to find an easier way
- You can use (an unsupported) SQL Server update to “reset/update” the email templates for any “existing” processes – including those underway, and those deployed already.
But – will have to leave that for now. I’ll detail THOSE approaches in the NEXT post…