cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
H-F
Level: Powered On

Button - IF Statement using global var

Global Variable is varStatus

 

Submit Button contains the following statement.  I have the varStatus value visible on my form for troubleshooting and I can see that it is set to Pending Manager Approval.  However, when I click submit it just sets varStatus to Approved when it should set it to Pending HR Approval.

If(varStatus="Pending Manager Approval",Set(varStatus,"Pending HR Approval"),Set(varStatus,"Approved"));SubmitForm(FormEdit)
 
Does anyone have any ideas about this?
5 REPLIES 5
TML
Level 8

Re: Button - IF Statement using global var

If you temporarily remove the SubitForm command, does the label update correctly?

Community Support Team
Community Support Team

Re: Button - IF Statement using global var

Hi @H-F,

 

Could you please share a bit more about your app's configuration?

Further, could you please share a bit more about the value of varStatus variable before clicking "Submit" button?

 

I have made a test on my side and don't have the issue that you mentioned. Please check if the value of the varStatus variable is "Pending Manager Approval" before clicking "Submit" button.

 

In addition, you could also consider take a try to remove the SubmitForm function from the "Submit" button, then try it again to check if the issue still exists. Also check if you have typed proper formula within the OnSelect property of the "Submit" button.

 

Please also check if you have added the Set(varStatus,"Approved") formula within other Action rule properties (e.g. OnSelect, OnSuccess, etc.) within your app.

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
H-F
Level: Powered On

Re: Button - IF Statement using global var

No, it still does not update

H-F
Level: Powered On

Re: Button - IF Statement using global var

My form contains the following.
Card: Status
TextInput6 default = varStatus
DataCardValue21 default = Parent.Default

 

Upon entering a new list item the Status is Submitted
My flow sends and email and sets the Status to Pending Manager Approval (I cut and pasted this into my Submit button formula).
On my Edit form I have an Approve button with the OnSelect formula of - If(varStatus="Pending Manager Approval",Set(varStatus,"Pending HR Approval"),Set(varStatus,"Approved"));SubmitForm(FormEdit)

I tried taking off the SubmitForm, and it still does not work, I can see on my form that it is setting the value of varStatus to Approved.

 

I tried deleting the OnSelect formula and putting it back, I also deleted the button altogether and it still did not work.

 

When I open my edit form I can see the TextInput6(varStatus) is blank while the DataCardValue21 is Pending Manager Approval.  When I click the Approve button (without submit) I see that is it setting the TextInput6(varStatus) to Approved while the DataCArdValue21 still shows Pending Manager Approval.

 

Is there any other information you need to try to help with this?

H-F
Level: Powered On

Re: Button - IF Statement using global var

I was able to get this working.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,263)