Forum Discussion
How to Send an Email when added a News Post in SharePoint Online site
This works 100% however..... If for some reason i go back to an older news post and edit or republish then another email comes out. Is there a way to send out the email on promote state = 2 (original news post) But not to send out any future emails even if someone makes a change to the post?
I'm probably too late to help anyone involved in the thread, however, for future users wondering how to solve this issue, here's how I did it.
There is a metadata field known as version number.
This number increments it's decimal component every time a draft is saved, the first draft will be saved as version 0.1, the next time you open the news page's draft, the auto-saves for that "session" will be saved as a version 0.2. The decimal will only go up once you save a "new" draft.
Once you publish the news article, said version number changes to 1.0, if you were to edit the published article, those changes would be saved as version 1.1 (1.2 if you save it as a draft and keep editing it later on).
If you then decide to republish the news article, its version number will update to 2.0.
As far as i've seen, the pattern keeps going on
Now back to the original question, to avoid resending emails for updated news articles we can simply add a second line to our condition that checks if the version number is exactly 1.0. This way our conditional block checks if the modified file is a published news page (thanks to the promoted state == 2 condition) AND if it's the first version being published (version == 1.0).
NOTE: The "decimal" portion of the version number doesn't act like a decimal; in practice it works more like a second index annexed by a dot.
The sequence of version numbers would go such as:
0.1 < 0.2 < 0.3 < ... < 0.11 < 0.12 < ... < 0.21 < 1.0 < 1.1 ...
I hope this helps any future lurkers.