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 / Field update as part o...
Power Apps
Unanswered

Field update as part of submit rule

(0) ShareShare
ReportReport
Posted on by 206

Let's say I have a PowerApp which is a custom SharePoint list form.  In the list, there is a field called "Status" which is a choice column with 3 values:  New, Submitted, Approved.  When a user creates a new form, status defaults to "New" and the status field is displayed in View mode so that it can't be changed.  When the user clicks the "Submit" button, I want the status field to update to Submitted status and then the form to be saved.  I'm not clear on the syntax for updating that Status column value in code prior to form submission.  I am sure it is easy but can anyone give me a hint?

Categories:
I have the same question (0)
  • pNabin Profile Picture
    249 on at

    Hi @blanghorst,

     

    You need to create a new variable (like varStatus) and set the default value of Status field to varStatus whereas items os status  be New, Submitted, Approved. 

     

    Then, OnSelect property of button submit, assign varStatus value to "Submitted" and save/submit the form like

    OnSelect = UpdateContext({varStatus:"Submitted"}); SubmitForm(Form1)

    Hope this will help you.

     

    - Nabin

  • blanghorst Profile Picture
    206 on at

    Thanks!  I'll give it a shot.

  • blanghorst Profile Picture
    206 on at

    Hi Nabin,

     

    So, I tried this and ran into a problem.  Correct me if I'm wrong, but I think you're saying the following:

     

    1. Use a variable called varStatus to store the Status value.

    2. Set the default value of the Status column to varStatus.

    3. Place the rule in your post on a button.  When the button is clicked, it will update varStatus and therefore, the Status column.

     

    If I try to place varStatus in the Default value,  I get a "The property expects Table values, but this rule produces incompatible Text values."  Keep in mind that the "Status" field is a lookup column in SharePoint, and I need to do the following:

     

    1.  When a new form loads (MyForm.Mode=FormMode.New0, I need to set the Status field to show "New."

    2.  When I click the SUBMIT button, I need to update that field to "Submitted."

     

    So I'm thinking that varStatus has to be some sort of lookup to the choice column where we filter it to Value=New, but I can't quite get that working either.  I placed the formula below in the Default value for the Status column and the Status field still is empty when I open a new form:

     

    If(
        MyForm.Mode = FormMode.New,
        LookUp(
            Choices('ListName'.'Status'),
            Value = "New"),
        Parent.Default)

     

    One other thing I mentioned - the field is currently in View mode.  Could that be the issue?

     

     

     

     

  • blanghorst Profile Picture
    206 on at

    I got it working.  Here is what I did so far:

     

    1.  On the status field, I changed the field to "Edit Lookup" from "Edit Selection" (not 100% sure if it was necessary).

    2.  On the default value for the Status field, I entered:  If(IsBlank(varStatus),Parent.Default,varStatus)

    3. On the Submit button, I entered:

     

    UpdateContext({varStatus:LookUp(Choices('ListName'.'Status'),Value = "Pending")});SubmitForm(SharePointFormName)

     

    Now, when I submit my form, it changes the status to "Pending" upon submission exactly how I wanted.

     

    Thanks!

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @blanghorst,

    Have you solved your problem?

    Based on the needs that you mentioned, I think it is not necessary to change the Status field (Combo Box) control from "Edit selection" to "Edit Lookup". In addition, it is also not necessary to initialize a variable to store the Status value.

    I have made a test on my side, please take a try with the following workaround:6.JPG

     

    7.JPG

    Set the DefaultSelectedItems property of the Combo Box control within the Status Data card to following:

    If(
     SharePointForm1.Mode=FormMode.New,
     {
     Value:"New"
     },
     Parent.Default
    )

    Set the OnSave proeprty of the SharePointIntegration control to following:

    SubmitForm(SharePointForm1)
    

    Set the OnSuccess property of the SharePointForm1 control to following:

    Patch(
    '20181130_case3',
    SharePointForm1.LastSubmit,
    {
    Status:{Value:"Pending"}
    }
    );
    ResetForm(SharePointForm1);
    RequestHide()

    On your side, you should type:

    Patch(
     'YourSPList',
     SharePointForm1.LastSubmit,
     {
     Status: {
    Value: "Pending"
    } } ); ResetForm(SharePointForm1);
    RequestHide()

    Please take a try with above solution, check if it help solve your problem.

    If you have solved your problem, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify.

     

    Best regards,

    Kris

  • blanghorst Profile Picture
    206 on at

    To be clear, mine is a dropdown list populated by a choice column in SharePoint.   It would've been easier had the person who built the list just made the Status field a text box because no one will ever actually manually specify a status.  Thanks for the information below, however - I will definitely take a look and keep it in mind.  I did get mine working per my previous post with only one little glitch, but it isn't important for me to resolve it at the moment.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard