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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issues changing a "Cho...
Power Apps
Answered

Issues changing a "Choice" field fed from Sharepoint with a button press

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have a Powerapps form which is feeding into a Sharepoint list - one of the fields is a Choice field on Sharepoint with "New", "Submitted", "Rejected" etc as options.  

 

I have the Default of this field setup as follows : 

 

 

If(
Request.Mode = FormMode.New,
{Value: "New"},
{Value: ThisItem.Status}
)

 

 

This sets the field to "New" if the form is opened in New Form mode.  I have a submit button which I am trying to make change this value to "Submitted" prior to submitting the form, then other buttons which will come later (Approve and Reject buttons) which will change this value to Rejected or Approved.  Not sure exactly how to do this though.  I've tried the following on the "Submit" button :

 

 

Set(Status, "Submitted")
+

SubmitForm(Request);

 

 

Now I understand why this isn't working - basically all I'm doing here is updating a Global variable called "Status" and not my Datacard called Status.  I'm just not sure on the correct code to update the Status Datacard.

 

Had a bit of a dig but can't find anyone with this exact issue.  Any help appreciated 🙂

Categories:
I have the same question (0)
  • David_G Profile Picture
    62 on at

    Hi,

     

    Can you try to use your Status variable as default value of your Datacard ?

  • Powertron Profile Picture
    on at

    I'd need some way to set this value to "New" by default though.  Maybe I could move my code to OnStart or something for the App?

  • David_G Profile Picture
    62 on at

    Yes you can set your Variable to "New" with the OnStart.

    If you prefer you can also use the OnVisible on the screen. But your variable will be set to "New" each time you navigate to this screen.

  • Powertron Profile Picture
    on at

    I don't think this is going to do what I want.  Or certainly I think I'd prefer to find a way to do this without using variables.  Basically all I want the form to do is have "New" as the status when I enter it initially in New Form Mode and then change this when I hit the "Submit" button.  I have tried puzzling out the "Lookup" function but this doesn't seem to work like I'd have hoped.

  • Verified answer
    v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @Powertron ,

     

    Is your requirement as shown below?
    1. If the form mode is New, the default value of the "Status" field is "New".
    2. Change the value of "Status" field to "Submitted" when submitting the form.
    3. Show Approve and Reject buttons.

     

    I have made a test for you  reference.

    1. Here is my SharePoint list.

    vyujincuimsft_0-1646818538775.png

    2. Select the Form and apply the following formula on its item property as:

    Last(datasource)

    3.  Select the Combo Box Control and apply the following formula on its DefaultSelectedItems property as:

    If(Form3.Mode=FormMode.New,{Value: "New"},{Value:ThisItem.status})

    4. Select the Add Icon and  apply the following formula on its OnSelect property as:

    NewForm(Form3)

     5. Select the Submit Icon and  apply the following formula on its OnSelect property as:

    SubmitForm(Form3);Patch(datasource,Last(datasource),{status:{Value:"Submitted"}});EditForm(Form3)

    6. Select the Approve Button and  apply the following formula on its OnSelect property as:

    Patch(datasource,Last(datasource),{status:{Value:"Approved"}});

    7. Select the Reject Button and  apply the following formula on its OnSelect property as:

    Patch(tmplist,Last(tmplist),{status:{Value:"Rejected"}});

    8. Select the Buttons and apply the following formula on its Visible property as:

    If(Form3.Mode=FormMode.New,false,true)

    Result:

    changestatus.gif

     

     

    Best Regards,

    Charlie Choi

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard