Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  Update SharePoint dropdown with Yes/No, when toggle is switched to Yes/No

    Bronze Contributor
    Posted Jan 30, 2023 06:36 AM
    Hello,

    I have a dropdown named as Profit into SharePoint with Yes and No option. And a toggle button with Yes and No switch.

    I have updated the Default property as below:
    FalseText is set to No
    TrueText is set to Yes
    If(ThisItem.'ToggleName' = true, true, false)​


    Now when I switch the toggle to Yes, my Profit dropdown should automatically get updated to "Yes" to the SharePoint list, else it should be "No".

    I looked around many searches but could not get a proper solution.

    Please advise.



    ------------------------------
    Prem Guru
    ------------------------------


  • 2.  RE: Update SharePoint dropdown with Yes/No, when toggle is switched to Yes/No

    Silver Contributor
    Posted Jan 31, 2023 04:20 AM
    Prem,

    I don't think you can update the default value of a dropdown with a toggle, at least not so that your visible dropdown value would change on the fly.

    I'm not sure what you are trying to accomplish here. Looking at your 'thisitem' code you are also using a form or a gallery?
    Also the fact that you are using a dropdown column in sharepoint with yes/no values is a puzzle to me, why not use the yes/no type of field. It's much easier to work with if you want a toggle in PowerApps
    If you are looking for a way to update your sharepoint Profit yes/no column from your toggle, that is possible.

    On the OnChange property of your toggle:
    Patch(
          Sharepointlist,
          Defaults(Sharepointlist), --> or whatever way to identify your record
          {
            profit: toggle1.value
          }
    )​


    ------------------------------
    Koen Mathijs
    ------------------------------



  • 3.  RE: Update SharePoint dropdown with Yes/No, when toggle is switched to Yes/No

    Bronze Contributor
    Posted Jan 31, 2023 06:33 AM
    @Koen Mathijs,

    Thanks! I'll give this a try.

    My actual query is different from the one that I mentioned in this thread.

    Actually I have a toggle inserted to the PowerApps form (added from SharePoint list). There is a Power Automate trigger to check, if the toggle is switched to Yes, an email will be sent , If No, will skip to send email.

    But for some reason, when we switch the trigger to "Yes", and after an email is sent, the SharePoint Trigger column gets unchecked and in PowerApps form also the Trigger column gets changed to No automatically.

    Basically what I was looking for - If trigger is Yes, update SharePoint List and PowerApps form.

    ------------------------------
    Prem Guru
    ------------------------------



  • 4.  RE: Update SharePoint dropdown with Yes/No, when toggle is switched to Yes/No

    Top Contributor
    Posted Jan 31, 2023 06:28 AM
    Hi @Prem Guru,
    If this is on a Form, then and assuming that the Profit field in SharePoint ​is a Boolean (Yes/No) column then the Default of the Toggle would simply be
    ThisItem.Profit
    and the Update of the Data Card (using the name Toggle1 - change if incorrect)
    Toggle1​.Value

    If however Profit is a Text field, then Default

    ThisItem.Profit = "Yes"

    Update of Data Card

    If(
       Toggle1.Value,
       "Yes",  
       "No"
    )


    ------------------------------
    Warren Belz
    MVP (Business Applications)
    Australia
    ------------------------------