Thursday, December 27, 2012

String.Replace and FIM EmailTemplates

Had this awesome idea the other day and totally got foiled by my FIM box.  Thought I’d be crafty and generate some fancy HTML for an email notification, then I’d use my Action Workflow to store that HTML snippet in the FIM workflow dictionary.  Next I’d consume it in my Notification Activity by simply referred to the workflow dictionary like this:

//WorkflowDictionary/MyHtmlSnippet

Would have totally worked too, but FIM pulled a fast one on me, and did some encoding on the data I stuffed into the dictionary, so by the time it was passed to the EmailTemplate it no longer resembled HTML, and of course didn’t render.

EmailTemplates and the WorkflowDictionary: 0

PowerShell WF Activity and Send-MailMessage: 1

Since I already was using a PowerShell WF activity to construct the HTML snippet, instead of passing the HTML snippet to the workflow dictionary, I just sent the message from PowerShell using Send-MailMessage. 

The best issues to run into are the ones where YOU can craft a solution.  In this case I can’t complain too much because I still arrived at a solution and it was actually easier to decorate with logging and exception handling.

1 comment:

Majd Andoni said...

This blog might help you, it addresses the issue of using a generic email template for email notification activities.

http://zevainc.com/index.php/blog/item/4006-using-workflowdata-to-create-a-generic-email-template