cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zigfridus
New Member

Posting news in Sharepoint. Flow triggers only once in Draft state

Hello

 

I created new Flow for the Sharepoint site, which should send an email when new post is Published.

But it doesn't send an email if the post is in the Draft state already. As I understand my Flow already triggered, when the new post swtched to the Draft state and after that when I press publish button it doesn't trigger.

It does work when a post still isn't in the Draft state.

 

Could you plese tell me how can I fix it?

 

Thanks

Annotation 2019-06-26 110437.jpg

 

6 REPLIES 6
Pstork1
Dual Super User III
Dual Super User III

The only real difference between a draft and published is that the published version is a major version and the minor version is draft.  Taht means the when a file is created won't fire when the page is published.  YOu'll need to change your flow to fire when the files is created or modified and then check to see if the version is a major version or not.

 

The problem is I don't know any way to retrieve the current version number of the document.  So I don't know how you determine whether this is a major published version or not.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pstork1
Dual Super User III
Dual Super User III

Here are two workarounds that should work.

  1. You can retrieve the current version # of the document using the Send an HTTP request to SharePoint action. Then you can have your FLOW only send the email when a major version is published.
  2. If you run the FLOW connector as an account that only sees the major versions then the File create Trigger will only fire when a major version is Published.

I suspect #2 is the better choice but it means creating and running the Flow with a different user context that has lessor permissions to the site. Not sure if that's convenient.  #1 will also work but it requires changing the trigger and will lead to more Flow runs.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
zigfridus
New Member

Thank you for your answer. I've tried to get the file's version from HTTP request but it wasn't successful. 

Could you please tell me what is wrong in this request:

_api/web/GetFolderByServerRelativeUrl('/SitePages')/Files('FullFileName')?$select=FileLeafRef,OData__UIVersionString

Pstork1
Dual Super User III
Dual Super User III

Take a look at John Liu's blog post on getting the version number.

 

http://johnliu.net/blog/2018/5/microsoft-flow-sharepoint-trigger-on-specific-fields-changed-via-sp-h...



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pstork1
Dual Super User III
Dual Super User III

I played around with it a little since John's post is for List items.  Here's the right REST call

https://acmee3.sharepoint.com/sites/FlowDemos/_api/web/GetFolderByServerRelativeUrl('SitePages')/Files('Home.aspx')?$select=FileLeafRef,UIVersionLabel

Two changes from yours.

  1. Remove the slash form Site pages.  It needs to be server relative not absolute.
  2. retrieve UIVersionLabel.  If that value is a whole number its major (ie. 1.0, 2.0, 3.0)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

I'm very sorry for the delay.

I've got another important task and have to complete it.

After that I'll try to do that You adviced me.

Thanks

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Users online (2,793)