web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Problem with updating ...
Power Automate
Unanswered

Problem with updating a Yes/No SharePoint column

(0) ShareShare
ReportReport
Posted on by 19

Hello,

I am very new to power automate so please forgive any lack of common knowledge relating to this issue. 
The functionality of the flow is to trigger when a News Post on a SharePoint is created/modified (the post gets saved in SitePages folder by default). It will then post a message on a teams channel and then it should turn the "Toggle" Column to "No" (False). The only part currently I have problem with is changing the Yes/No column after the post. 

Relloy_0-1691592621726.png
This is currently what I have, to explain the 3 HTTP requests part they are all POST requests. I was following the steps I found online by someone else with similar needs (Solved: Updating SharePoint Page content SharePoint API - Power Platform Community (microsoft.com) ):

POST request with checkout method ( _api/sitepages/pages(@{triggerOutputs()?['body/ID']})/checkoutpage )
POST request to edit "Toggle" column with SavePage method ( _api/sitepages/pages(@{triggerOutputs()?['body/ID']})/SavePage )
POST request with publish method ( _api/sitepages/pages(@{triggerOutputs()?['body/ID']})/Publish )

 

When running the flow by creating a new file, the default "Toggle" value is "Yes" (True). It seems to run for several minutes stuck on the SavePage method, reporting a Bad gateway and retrying a few times. It also seems to also spawn a new instance of the flow trying the same thing. 

Relloy_1-1691593381478.png

 


I am not sure where to go from here, I attempted without the checkout and publish methods but I always get a error "We cannot save your changes because a site member has ended your editing session." I do not believe a delay would help and I would rather not delay the trigger if I can help it. 

I am open to any other workarounds to simply edit a single column of a New Post that resides in SitePages.

Any assistance is appreciated!


Categories:
I have the same question (0)
  • wskinnermctc Profile Picture
    6,519 Moderator on at

    Not sure about everything you are doing, but I know the Yes/No options are always tricky to deal with.

     

    I can't tell what value you are using to update the Toggle field, but I would test "0" or int(0) and see if that changes anything.

     

    I think using zero 0 is what will set a Yes/No field to No.

     

    As for all of the HTTP request stuff, I don't know, but try updating the field with different types of the number zero 0 and see if that helps.

  • Relloy Profile Picture
    19 on at

    Ah I forgot to add that information more clearly, in my original post I was updating the Toggle field with a "0".

    Relloy_0-1691603155594.png

     



    I have attempted with a int(0) (as plain text and as a expression). It seems to produce a similar reaction, it gets stuck on the SavePage method with the status message "BadGateway". 

    Hmm, I guess if Yes/No options on sharepoint are tricky I will try to use a "Number" Column instead and simply flip between 0 & 1 just like a Yes/No would. 

    Any other further advice would be appreciated, if you require to see more into my flow let me know which part and I will try to provide you the context. 

     

    Thanks

  • wskinnermctc Profile Picture
    6,519 Moderator on at

    Did you double check the column name and make sure it is Toggle? 

     

    There is an internal column name and a display/title name of a column. If you initially created the column with a different name and changed it, the you should try using the original name.

  • wskinnermctc Profile Picture
    6,519 Moderator on at

    You could also try adding the headers that are shown in your example link. The Accept header really should only impact what data is returned, but the Content Type might make a difference.

     

    wskinnermctc_0-1691605792045.png

     

    The example used odata=verbose, but you don't have any metadata in your body so I put odata=nometadata

     

    {
     "Accept": "application/json;odata=nometadata",
     "Content-Type": "application/json;odata=nometadata"
    }

     

    I'm not an expert at http requests, really just troubleshoot guessing.

  • Relloy Profile Picture
    19 on at

    Regarding your two points, I have confirmed the internal name of the column is also "Toggle" and I have attempted to add the accept and content header. Unfortunately the flow reacted the same as before.

    I might have found an alternative solution, rather than using HTTP requests, I can use "Update Item". 

    Relloy_0-1691674095337.png

     

    After a few tests it appears to be working well when creating a new post, after its posted the Yes/No column gets updated like expected.

    I am now running into a problem with SharePoint's AutoSave Draft feature, if somebody idles a bit on making a new post it simply creates a new file with a generated name until its finally published.

    Relloy_1-1691674512213.png

     


    This is a problem because the trigger fires as this draft gets created. I looked for a way to disable this AutoSave Draft but I have not found anything so far. So funny enough it does update the Toggle column even if its a draft, but it posts with the draft version and then when finally published it does not trigger since the Toggle column is already updated.

    I have tried adding 

    @not(triggerOutputs()?['body/{IsCheckedOut}'])

    to my trigger conditions but then it does not trigger on a regular Post as well. I will try a bit more troubleshooting but if you are able to see my mistake let me know.

    I appreciate all the advice you have given, thanks!

  • wskinnermctc Profile Picture
    6,519 Moderator on at

    I'm unsure about that trigger condition. I think it's on the right track, but it might need to be more clear about comparing values. 

    I don't know what the outputs are supposed to be, but I know the trigger condition has to equal true.

     

    Is there like a field "IsCheckedOut" = true in the body? 

     

    You could try something like equals(triggerOutputs()?['body/{IsCheckedOut}'],true) 

    or equals(triggerOutputs()?['body/{IsCheckedOut}']?['Value'],true)

     

    Not exactly sure and you probably know better,

  • Verified answer
    Relloy Profile Picture
    19 on at

    I believe I found a decent enough solution: equals(triggerOutputs()['body/PromotedState'],2)

    I was checking a few tests and noticed that "IsCheckedOut" field was not there so I looked for another variable to compare finished published page vs drafts. 
    I came across a post mentioned PromotedState:

    Relloy_0-1691689752155.png

     

    So now my trigger only fires on published pages which my intention for now. 
    I appreciate your replies which honestly gave me a few hints on where I should look next. 



Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard