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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Updating Various Fields Based on 1 Selection

(0) ShareShare
ReportReport
Posted on by 20

I have a SharePoint list as my data source. I am trying to have it so that if the person, enters a new record or updates an existing record, selects “Free” from a list in the R-Payment-Method field (this is a choice field), that it then sets:

  • the R-Cost Center/GL Number field to “NA”
  • the R-Ad-Posting-Cost field to 0.00
  • the Billing Status field to “Free” (this is choice field)

If something else is selected in the R-Payment-Method field then it should allow the user to select/enter other things in the fields. I keep getting a Network error when using patch function.

I have been trying to set the R-Payment-Method field’s OnChange property to the code below:

Patch(

    'Demo Ad Log', Defaults('Demo Ad Log'),

    If(

        DataCardValue45.Selected.Value = "Free",

        {

            'R-Cost Center/GL Number': "NA",

            'R-Ad-Posting-Cost': "0.00",

            'Billing-Status': {Value: "Free"}

        }

    )

)

What am I doing wrong here?

Thanks

Nick555_0-1692731717493.png

 

I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,512 Moderator on at
    Re: Updating Various Fields Based on 1 Selection

    Hi @Nick555,

     

    With the current code you are trying to create a new record in the SharePoint list with those values and it is missing the required Title field. I think the best approach would be only changing those values when "Free" is selected and the user submits the Form.

     

    The code below will assume that you are using SubmitForm to patch the data to SharePoint.

     

    (1) Change the Cost Center TextInput (DataCardValue) Default property to:

    If(DataCardValue45.Selected.Value = "Free", "NA", Parent.Default)

     

    (2) Change the Posting Cost DataCardValue Default property to:

    If(DataCardValue45.Selected.Value = "Free", 0, Parent.Default)

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Nick555 Profile Picture
    20 on at
    Re: Updating Various Fields Based on 1 Selection

    Yes, it does! Thank you very much!!!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 663 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 398 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard