How to send email if a specific field changes in SharePoint (versus just any field in the list item)
You need to send email when specific field changes in SharePoint, based on a field changing instead of just any field in the list item. SharePoint has provision for users to set up alerts when items in a SharePoint list change. However, sometimes you only want an alert when a specific field changes. For example, you may only want to know when a field such as Target Delivery Date changes.
You can set up this email trigger by performing the following (each described more fully further below).
1. Set up a “helper” column that will serve as the basis for keeping track of any pre-change state.
2. Set up a SharePoint workflow to determine whether a specific change has been made, and if so update the helper column and send an email.
From the steps described above you can see you’ll need to use the SharePoint Designer (a free download from Microsoft) to create the workflow you’ll need to manage the state, evaluate the change, and send the email.
Creating the helper column
Let’s say you have a column called “Target Ship Date” in your SharePoint list, and this is a date column. You’ll need to create another column in the list called “Target Ship Date (Before)”, also a date column. Note that the key things here are that the data type of the helper column needs to match your main column and that the “(Before)” that I added on to the name is just a simple convention to make remembering the columns purpose easier. You can create any name you wish.
Creating the workflow
Start SharePoint Designer for your site and go to Workflows in Site Objects.
Then click the List Workflow button up in the ribbon and pick the SharePoint list you’re going to work with.
Give your workflow a name.
In the view that comes up next, click in the Step 1 box, and then click Action up in the ribbon. Choose Set a workflow variable from the drop down list.
Click workflow variable, and then pick Create new variable. Give it a Name (let’s use “isDateChanged”), and select Boolean as the Type, then click OK.
Now set the initial value to “No”. Here, you just click value and then click No.
Check for change
Now you’ll add a condition to compare the previous state to the current state. There are a bunch of steps here, but hang in there and you’ll get thru it.
- Click Condition in the ribbon and select If current item field equals value from the drop down list.
- Click on field and pick Target Ship Date (Before) from the list.
- Click on equals and change to not equals.
- Click on value and click the Fx button. Select Target Ship Date from the Field from source listing.
- Click inside the condition you just created, and then click the Action button in the ribbon. Select Set Workflow Variable from the drop down list.
- Click workflow variable, and pick Variable: isDateChanged from the list.
- Click value, and set to Yes.
- Now click the Action button in the ribbon again and then pick Set field in current item.
- Click on field and pick Target Ship Date (Before).
- Click on value and click the Fx button and set Field from source to be Target Ship Date.
When the above steps are completed, you should have a step in your workflow as pictured here.
Create the email condition
- Click outside the condition block you just created. You’ll need to point your cursor near the bottom, and some gray boxes will appear to show you what is inside the condition block. When you click in the right place, the orange insert bar will be at the same indent level as the “If” statement above. See the picture below.
- Click on Condition in the ribbon, then pick If any value equals value.
- Click on the first value link and click the Fx button. Change Data source from Current Item to be Workflow Variables and Parameters. Then set Field from source to be Variable: isDateChanged.
- Click on the second value link and pick Yes.
- Click inside the condition block you just created and then click Action in the ribbon. Pick Send an Email.
- Click these users and complete the email form as you would an email. You can add the field values in the body of the email by using the Add or Change Lookup button at the bottom of the form.
Phew! When you’ve completed all of the steps above you should be looking at something very similar to the following image.
You’re in the home stretch
Finally, click Workflow Settings up in the ribbon.
Check the box next to Start workflow automatically when an item is changed in the Start Options box. Do NOT check the box next to Start workflow automatically when an item is created.
Click Publish up in the ribbon, and you’re all set! You’re ready to send email when a specific field changes in SharePoint.
There you go.
Brilliant!
Very easy to follow and implement.
One question, the two fields in the email are displaying the exact same date. Is there a way to display the original date before the change?
Worked it out.
Placed the “then set target ship date etc” after the email action.
Viola!
Thank you for this.
When I change a variable for the first time, the helper variable is blank. Is there some way to fill this with the value of the actual column before starting the workflow? I don’t want to change them to a lookup value as this will not work with the workflow described above…
You might decide to create a separate workflow that runs when the item is created that sets the helper value to initially match the column in question. Then you can still look for a delta between new and old to recognize a change. If you set the helper to match the new at the beginning of the workflow you eliminate any differences right off the bat and this method as is won’t work. HTH
Hi Charlie,
I have done this and it almost works… However, I have 2 variables that are choice variables and these have a default value set. When I output the old values of these in an email, they show the default values, not what they were set at when the item is created. Other variables show whatever I have input when creating the item. Any ideas what might be causing this?
Thanks
Kate.
It’s hard to tell without looking at your workflow. But I’m guessing it might be related to when your email step is running relative to getting the value of the field. So imagine setting two workflow variables at the beginning of your workflow. One you’d set to Current Item: Field1. The other you’d set to Current Item: Field1 (Before). The first would have the new value you selected on your form. The second should have the default value from your selection list if this is at the very beginning. So if this checks out, it’s just a matter of sorting out the logic/flow in your workflow. HTH
This is a great solution, I just don’t get why the variable is necessary. When the dates don’t match, why can’t I just tell it to set the date and send the e-mail? What is the function of having the additional variable and setting it to yes or no?
I suppose you could do that too. In the workflow I finally ended up with I also set a temporary variable to hold the old date. In the email that I sent I could send the new date as well as the previous date which was in a workflow variable. There’s more than one way to skin the cat.
This is a great solution, I’m just not sure why the variable is necessary. Why not just have the workflow set the column and send the e-mail? What is the function of creating and setting the variable?
Apologies, thought my original post did not save. Thanks for the reply 🙂
Thank you so much!! I modified it so that no email is sent in the first instance (cause i have a submitted’ email) and moved the email part before you set old to new… Love your work =)
Hey thanks for this information. However, is this feature available in the basic SharePoint Foundation version? I have just signed up for a free SharePoint site with http://www.cloudappsportal.com
I would think as long as you can open the site with SharePoint Designer you can set this up.
Charlie
I have a comments field that captures the running comments and the option to append to previous text is on, both in the “comments” column and the “helper” column. Both are empty initially – it does not fire an email since both are blank initially?
That’s correct. If both the values are the same that would indicate there is no change. In your particular example (running comments) you can add an email alert when there is a change while making the most recent comment available for viewing. To see what I’m talking about, take a look at another article of mine called “Show the Most Recent Comment from SharePoint Text Fields Instead of ‘View Items'”
https://officepowerups.com/2013/06/25/sharepoint-show-most-recent-comment/
Charlie
I have an interesting problem. I followed the steps and this works but for some reason only when certain people make the change. Those people also happen to be the same ones who are to receive the email.
That does sound unusual. There’s nothing about the example above that limits based on the record modifier. Are you sure you don’t have something in the condition pertaining to the modifiers name?
I followed the instruction exactly as written. Believe it or not I discovered that the problem seemed to be tied to permissions. When I changed user permission levels from contribute to edit. it started working? Go figure.
Thanks for the extra info!
Thank you for this it works but when I got to 9. click on field, the dropdown only had Comments, Content type ID, Name (for use in forms), and title to choose from, I chose comments and it worked but why didn’t I have the list of fields.
Regards
Hi, your instructions have proved very valuable in setting up a list where 2 name fields in a project list change. I have used the instructions to setup an email notification workflow for each name field change. The problem I have is that the workflow seems to trigger on any change not just the name changes. Any ideas why this may be?
Thanks, Kevin
That’s correct. The workflow will run on any change. The conditional you add will ensure that the email only sends when the fields of interest change. HTH
Hi, I also followed your steps and it works though mine also initiates the email on any field change. I’m not following what that condition would be to only send the email when one specific field changes.
In your workflow, you need to ensure the email action is within a condition that compares the “before” field value with the current field value and only send the email when the values don’t match.
Without using such a condition, the email action would trigger every time the list item is changed based on the main workflow setting.
Ive also followed your example to the letter and my workflow starts when any field in the list changes…what have I done wrong Charlie? Any help greatly appreciated. Thanks Matt
Yes, the workflow will start with any change. However, you need to manage the actions and the conditions so that only specific actions run when the fields you care about change.
Be sure you’ve captured the value of the original field and set that to the ‘before’ field. And also be sure to do your comparison before you update the field values.
HTH
Hi again Charlie, my (Before) date always ends up being the same as the date that has just changed when the workflow runs, why am I not recording the previous value when I follow your example?. Quite frustrating this, but I do appreciate your help 🙂
I added an illustration to the Check for Change section to hopefully make it easier to follow.
Im matching your screen shots entirely, I have used a 2010 and 2013 workflow and still the (Before) date ends up being the date that it changes too. Hmmm
Thanks for sharing such a very informative blog.
To manage this auditing task automatically in my work-place, I use LepideAuditor for SharePoint (http://www.lepide.com/sharepoint-audit/ ) that works awesome. It audits all changes in real time and provides the captured data at granular level. It comes with “Instant Alerts” feature that alerts instantly by sending customized email notification when any critical changes made in.
I setup this workflow exactly as instructed but e-mails are still getting triggered with changes to any field in the list. The fields I am using are Person or Group fields so that when this field is assigned/changed, an e-mail should be sent to all users in these fields. However this is still not working.
hi, is there a way you can send in a screen shot of your workflow steps for this?
Great solution, thanks! Is there a way to hide the (Before) column so the user doesn’t see it?
Yes. It depends on whether you want to hide from a list view or from the email. If in a list view, go into the view properties and uncheck the name of the ‘before’ column. If it’s the email, just delete the line and field name about the ‘before’ value. The email is just FYI info so it has nothing to do with triggering the action.
Hi Charlie,
I have followed your steps till the part where I need an orange line, which I simply cannot find it. Can you help me do that? I really need to get rid of emails sent whenever anything changes in the item.
The bars and borders should appear as you move the cursor over various parts of the workflow conditions. You don’t see those? Which version of SharePoint Designer are you using?
I am using SP Designer 2007…
I see. I don’t have that version (I only have 2010 & 2013). The thing you need to do is just ensure that the next task is *outside* the IF statement. Just add another step block. That would work too.
Thank you again for the help, Charlie.. I will try that tomorrow when I’m back in the office. Really appreciate your support.
How do I get my before column to match my old?
If you don’t have a crazy number of records that need to be updated you can create a view that has, for example, the before and after column visible. Select as many rows as you can from the old column, grab the fill handle (I’m assuming you’re in edit mode on the list) and fill to the Before column.
You can do this before adding the new workflow.
Can you do this with a column that is People and Groups? I’ve set this up and it sends the email when I update the first column, but doesn’t update the helper column.
I believe so, but make sure the values being stored/compared are the same. With People you have different versions of the values to work with. For example, you can store or view the Login ID in one field while the name may be stored in another. Comparing these would fail so be sure the same values are used in each field.
Thanks Charlie. I actually figured out how to do it, and, yes, one of the issues I ran into was indeed the “type” of value in the fields. I had to tweak them a bit, including how I passed them into the variables and, even better, was able to set up my workflow so that if you add yourself to a field that allows multiple people and groups, an email gets sent, but if you remove yourself, no email is sent (which was the desired output). So now when the field in question gets updated, it’s “aware” of whether or not someone was added to the list of names, or removed, and responds accordingly.
Thanks again, appreciate the post and the response.
i am trying to do this but in a comment field where in users can input multiple lines but its not working. I followed exactly the instruction. Is this only applicable to fields with fixed character like number / date?
Yes, this works with multiline text fields.
Does this need to be done with Visio 2013 or will 2010 work? When I click the dropdown for Condition, I do not have the option for ” If current item field equals value.”
The screenshots were taken with SharePoint Designer 2010, but in SharePoint Designer 2013 the option is there as well. I don’t know about Visio tho.
This was an excellent post- thank you. Got it to work perfectly except…
I need it to send an email only when a request is REassigned (i.e. Owner changes), not when it is initially assigned. So, no email should be sent in the first owner assignment instance (null=> value1) but it should be sent in all subsequent changes in the owner field (value1=>value2+).
I’ve done exactly what you have done above, and I am using SharePoint Designer 2013. Could you possibly explain how to amend this workflow to achieve my objective? Thank you!
If this only happens when the record is created just change the workflow to trigger on modify instead of on create.
If the assignment can happen later (on modify) add a condition to test for an empty value as well.
>>>> If AssignedTo AssignedToNew empty
>>>> –AND– if AssignedTo
>>>> … the rest of your workflow
This is very helpful thank you!! What does this look like in the flow? I can’t find the breakdown with that was above.
I can’t attach a picture here. But your flow will have two lines. Be sure to select AND rather than OR for the condition between the two lines.
Hi Charlie- I’m stuck on this one. I was able to get the workflow working for all fields without a name, but when I try do it where an owner is assigned. I am inserting the condition “If value equals value” and I am changing it to If OWNER (BEFORE) not equals” when I click value it only lets me pick a specific name and not OWNER. What am I missing here? Thanks for all of your help.
Hi Charlie. I have an interesting issue with this solution. It works great when someone changes a due date. However, I am getting an alert on item creation that tells me the due date has been changed form 4 am to 12 am. Mind you, these fields are set for date only, not time.
I have other solutions that auto-populate certain fields on item creation. So even though my Due Date change Alert workflow is set up to trigger on item change, I am getting it on Item Created. I realize this may be because of the auto-population of fields, which technically occur after the item is created.
I just don’t see why I’m getting the alert telling me the time stamp has changed…and it only happens when a new item is added. Any thoughts on this ? Thanks
All I can think of is in the field definition (where you select between Date Only and Date & Time) you have a default value that is setting the time portion to 4am. When a change is made, the default SharePoint time of 12am is set and you see a change from 4am to 12am. That’s just a wild guess tho.
The simple solution without code is to use alerts to adjust it to send an email if the item added or changed, not as your condition specifically.
That’s the default behavior, yes. But often times it’s completely inadequate for what’s actually needed. That’s why I use the approach described in this post so often.
Thank you. Very useful!
Hi , this solution is really good and I tried to implement this which served the purpose. I have a doubt here and it is as below –
I have a list and in that list I have the column AccountNumber (single line text entry), while following these steps I created the helper column as AccountNumber(Before) (single line text entry).
Now I am not able to understand how the helper column will have the initial value of the original column. When it is triggering the email on updation it is containing the same value for both the fields –
Value Before : 123426559
New Value : 123426559
if you pleases guide me here, would be really helpful for me.
When the workflow runs, it compares the value in the ‘before’ field to the original. If they do not match, the ‘before’ value is set to the original so that next time a change will be detected.
If the email is created before the values are set, you’ll see the difference. If you build the email after, the ‘before’ and original will match. That’s not as clear above.
Basically I am not able to catch the previous value in the helper column i.e. AccountNumber(Before)
I tried to put the email before and then set the Before field as below –
————————————————————————————————-
Set Variable:isAccountNumberChanged to No
If Current Item: AccountNumber(Before) not equals Current Item:Account Number
Set Variable: isAccountNumberChanged to Yes
then Email: techsupport@gamil.com
then Set AccountNumber(Before) to Current Item:AccountNumber
—————————————————————————————————–
but Before value is cathching the blank value.
Account Number Before:
Account Number Changed With: 123456699
————————————————————————————
One thing I understood is, if I can set the Before field Default value as with the original field initial value then this issue will be resolved.
But I am not able set the Before field default value witht the actual field original value. Can you please guide me how I can do it using a workflow.
Also if you can enable image upload in this comment box then it become more easier to explain with the appropriate screenshot.
For now I resolved it. I have created a separate workflow to capture the initial value of the AccountNumber field in AccountNumber(Before) field and I have executed it on Creation only –
then I folowed your steps mentioned here but I removed the
then Set AccountNumber(Before) to Current Item:AccountNumber
from the Action.
Now – it is capturing the first value of the AccountNumber in the AccountNumber(Before) field, but it is not capturing the updated value in AccountNumber(Before).
If I consider one time update , then it is okay, but for mutiple time updation it is still need to capture the updated value of AccountNumber in the AccountNumber(Before) .
You can also use a workflow by running the workflow automatically on add and change by writing conditions to check the value of field and action to send the email for
thanks for this!! Hopefully you can help me… I followed instructions but I have a list that has a term date that I’m having the workflow trigger an email to HR when date is entered.. But, if the person comes back next year (typically interns) we delete the “off-board” date. I get an email but it says: 1/1/0001.
Is there any way to modify so I don’t get an email when the date is blank after modifying the list?
I would add a condition to check for that before sending the email.
Try something like:
… and If TermDate is less than 1/1/1900
>> then send Email, or whatever