My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

25 September 2008

How to trigger a workflow based on a non-empty Comments field?

by Patrik Luca 6 comments

Tag



At an installation where I created a helpdesk functionality based on the Help Desk template, one of the Application Templates for Windows SharePoint Services 3.0, I was asked to create a workflow which sends out an email automatically when a comments is added to a service request. The email may not be sent out if the comments added was empty.
I thought this wouldn't cause much of a problem and started creating the workflow with Microsoft Office SharePoint Designer 2007. The condition checked to evaluate if an email should be sent out was If Comments is not empty.


I created a service request, next edited it and entered a value for the Comments column. I received an email triggered by my workflow for this change, which was expected. I edited the same service request again, without entering a value for the Comments column. I received an email triggered by my workflow, which I didn't expected, as my Comments added was empty. I edited the service request again, entering a value for the Comments column, resulting in the expected reception of an email.


So apparently, the Comments column wasn't empty, even if you didn't enter a value for it upon editing the service request. I thought this had something to do with the fact that the Comments field was a Multiple lines of text type of information field with the property Append Changes to Existing Text set to Yes. But I had no idea why the workflow reacted on each change of a service request as if the Comments field wasn't empty. So I created another workflow which copied the value of the Comments field into another field. This other field had as type of information Single line of Text. I immediately understood why the workflow sent out an email each time: apparently there are <div> tags placed around each Comments field change. Not entering a value for the Comments field, nevertheless resulted in a value of <div></div>. So I changed my workflow to take this into account, and hey, no mails were sent out anymore if the end-user edited a service request without entering a value for the Comments field.

Comments 6 comments
Sietse said...

Hi,

I saw an old Post on technet with your name on it. There's still no awnser posted on your question. It was a question about moss with a Lotus notes email server.

Can you tell me if this is possible?

Thanx,

Sietse van der Haar
vanderhaar@gmail.com

what are the common pittfalls or things we should be aware if a customer has a Lotus Notes Mail Server in stead of MS Exchange and wants to use MOSS 2007?



What I think of:

* will email alerting work with a Lotus Notes Mail Server?

* will integration of calendars work between MOSS & Lotus Notes?

* will integration of tasks work between MOSS & Lotus Notes?

* will integration of contacts work between MOSS & Lotus Notes?

* will it be possible to take doc libraries in read-only mode offline in Lotus Notes client?

Patrik Luca said...

Hi Sietse,

I've never had answers from anybody. So the be honest: I still don't know if this is possible or not...

Jennifer said...

Hello, Thank you for this post! Very helpful! In my workflow, I also want to display all of the items listed in the Comments in my workflow email not just the last one submitted. Is that possible? I can't seem to get that to work.
Thank you!
Jennifer

Patrik Luca said...

Hi Jennifer,

I don't know if it is possible.

Anyway, if it is not possible straight away a workaround could be to create an additional field. By using an event receiver you could add each comment to that additional field (the additional field is without append changes set to yes). You could use this additional field to fill up the email generated by your workflow.

You could make this additional field non-editable in the user interface or hide it, so the end-user is not bothered by it.

Hope this helps you further.

Anonymous said...

brilliant!

Anonymous said...

I've been searching for a solution for weeks. The "div" tags was the answer. Thank you to posting this. You rock!

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Live Traffic Feed

Recent Visitors

Blog Archive

My Blog List

Followers

Guest Links