0

I have a list with a multiple choice column - 'Department'(dropdown).

I essentially need to send out an email notification to the department group (Sharepoint Security group) depending on which department the user is assigned to and am able to do it by listing out every department listed out.

However, I was wondering if there was a much elegant way to do it by using variables or parameters. Example: If Department (D) changes to New department (N) send notification email to SharePoint Group N (Associated group to specific department).

Is this possible in SharePoint designer or would it require Visual Studio?

Any other suggestions are greatly appreciated as well.

2 Answers 2

1

This would be pretty tough to do in Designer, as you don't have a lot of control over when in the object life cycle you get to run the workflow, and on top of that even though I believe that you can set it so that it technically runs OnItemChanged, in actuality you don't get access to any of the BeforeProperties of the item in question - in short, you can make a workflow that sends an email any time an item is changed, but it'll send an email on any change.

If all you're doing is sending an email, I'd set up an event receiver that operates OnItemChanged for the list, make sure that the BeforeProperties and AfterProperties of the Department field are different, and then only send out the email if they are (there's a method you can call with SPUtilities.SendEmail() that allows you to put in an email address, subject line, and body).

1

You could also set up a custom list with the title field, a subject field, and an email address field. Here you would configure all the email settings for the values in the drop down list. Then in your workflow, you look up to this list to fetch the data needed to send the email.

The pro and con of this is that it can be easily edited by the users without need to build/package/deploy any custom code or republishing a workflow (so proper security on the list is key).

If you want some sort of tracking, you'd have to build that into the list metadata but hidden from the forms. In the workflow you'd have to determine if the visible drop down is the same as the hidden field. If it is you wouldn't send an email. If they are different, then you'd lookup and email the users in the visible dropdown then update the hidden field to the new department.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.