How can I stop the same email from sending by a custom workflow twice?
-
07-02-2021 - |
Question
I have a custom workflow I made in SPD that sends an email to different people depending on the value of a column, in this case it's when it's their turn to edit a document. The person will get an email from the workflow notifying them of the task, and then they edit the document. Then when they save the document, they will get the same email again since the document has changed, but the document property hasn't. Then they will have to go to the document and edit the property to assign the task to the next person.
The workflow is:
If current item field equals value
Email these users
I want to eliminate the repeat email. Is there a way to do this?
I ideally I would want a way to make the properties box appear every time the document was saved, but if that is not possible then I want the workflow to only email when the value of the column changes.
I should note, I am currently using SP 2010, but we will be upgrading to 2013 soon.
Thank you
Update: I got the workflow to work using the second option listed in the Answer below as well as adding one other part. The document needed to be checked out and then checked back in before the workflow can make changes.
Solution
The only way I believe you can do this is if you create a second column for each column you're evaluating. If your main column is status
, then create a new column named something like prevStatus
.
If your workflow only sends a single email, for clean "code" you can then place an IF condition that says if status equals prevStatus; end workflow
before your previous IF condition:
If status equals prevStatus:
end workflow
If current item field equals value, and the Action
Email these users
change prevStatus to Status
If you do other things in your workflow maybe structure it this way:
If status not equals prevStatus:
If current item field equals value, and the Action
Email these users
change prevStatus to Status
Then you can have multiple columns to monitor:
If status1 not equals prevStatus1 OR
status2 not equals prevStatus2 OR
statusN not equals prevStatusN:
If current item field equals value, and the Action
Email these users
change prevStatus to Status