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 Apps / Switch statut between ...
Power Apps
Answered

Switch statut between 2 set functions

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

I have a question regarding the set functions.

I have a field Status and 2 buttons in Powers : 1) Send as Draft 2) Save & Send

The status field by default should be "Nouvelle Demande"

 

What i want is when i click on the button "Send as Draft" he should change the Status to "Draft" and when i click on the button "Save & Send" the status should change to "Send"

 

See below the screen shots.

 

Any ideas ?

Thank you



Statut by default :  111.PNG

 

 

Button Save as Draft :  112.PNG

 

Button Save & Send : 113.PNG

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    I assume you have a column in your list called Status that is a Text column.

     

    Consider the following:

    1) Change your Save as Draft to formula to the following:

        UpdateContext({saveStatus:"Draft"}); SubmitForm(Form1)

     

    2) Change your Save & Send formula to the following:

        UpdateContext({saveStatus:"Send"}); SubmitForm(Form1)

     

    3) In your EditForm, set the Update property of the Status datacard to the following:

        saveStatus

     

    This should give you what you want.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    Hello @RandyHayes ,

    Thank you for the UpdatContexte it does work well.

     

    For the 3rd part, i still cannot update the status, check the screenshot.

     

    114.PNG

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    In this particular case I provided, we are shorting the EditForm functionality by directly altering the Update property.  What this means is that whatever value is in the saveStatus variable WILL be written when you SubmitForm.   It will, however, NOT display on the screen at that point in time.  If you were to look at your data list, you *should* see the value has been written there successfully.  If you were to then Edit, in the EditForm, that same record, it *should* show you the correct value.

    My assumption was that you were not displaying the status, but simply forcing a status to it.

     

    If you want to display the value as well, then consider the following changes:

    1) Return the Update property of the DataCard to the original formula (most likely DataCardValuexx.Text - replace xx with the appropriate number).

    2) Change the Default property of the DataCard to the following:

       Coalesce(SaveStatus, ThisItem.Status)  or whatever the name of your field is (assumed Status)

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thank you  @RandyHayes 

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard