cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Help with if statement

Hi

This is what I am trying to do, I have a submit button and on the DisplayMode property of the button I am trying to:

If the logged in user is Reviewer4, the button should be clickable (edit), else it should be disabled for all other users. I can get this to work.

But when Reviewer4 clicks the button to submit the form, I have another variable vWait, which needs to disable the button even for Reviewer4 , until it successfully submits or if it fails, I can't get the syntax correct to cater for 2 different if statements:

If(
VarUser = Reviewer4, DisplayMode.Edit, DisplayMode.Disabled);// semi colon or comma and it complains
If(vWait, DisplayMode.Disabled,DisplayMode.Edit)

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Hi @Lefty ,

Try this

If(
   VarUser = Reviewer4 && !vWait
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted

@WarrenBelz 

I've just had a thought,

if put the following on the Visible property of the button, then only this user will see the button:

VarUser = Reviewer4

Then on the DisplayMode of the button I can simply put:

 

vWait, DisplayMode.Disabled,DisplayMode.Edit

 

Your thoughts?

View solution in original post

12 REPLIES 12
Highlighted
Advocate I
Advocate I

Hi guy,

Where are you putting the code?

Do you has a printscreen?

@Paulo_VS 

 

The code as mentioned is being set on the DisplayMode of the submit button

 

I'm sure I've got the syntax wrong, and just needs tinkering

Highlighted

@Lefty


Where is the user profile defined? 

 

Highlighted

User profile? I think you have misunderstood my question, there is no requirement for user profile.

Highlighted
Advocate I
Advocate I

So what would Reviewer4 be, how does a user that Reviewer4 characterizes, what field does this validation take?

Lefty - ["If the logged in user is Reviewer4...."]

Highlighted

@Paulo_VS 

Reviewer4 is a person field from its datasource (SPO list)

Reviewer4 is entered by an approver in the previous section, and the Reviewer4 receives an email - All of this works

 

The button I have enabled for Only Reviewer4 to click, for everyone else is it disabled - This also works.

 

Now I need to add a further logic, when Reviewer4 clicks the submit button the button needs to be disabled for them also, while the submission of the form is taking place, this is via the vWait variable, but I cannot get the syntax correct for both statements

Highlighted

Hi @Lefty ,

Try this

If(
   VarUser = Reviewer4 && !vWait
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted

HI @WarrenBelz 

 

I tried something like that, but correct me if I'm wrong in my understanding:

If(
   VarUser = Reviewer4 && !vWait // This is saying, if Reviewer4 and vWait is true, the displaymode will be edit? If yes, That's not quiet what I want.... I'll continue outside of this....
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 .... if VarUser is Reviewer4 the button needs to be clickable, but once the user (Reviewer4) clicks the button, I need the button to be disabled for Reviewer4 as also, to prevent them from clicking the button several times.

Highlighted

Hi @Lefty ,

I am guessing a bit here, but if you set vWait to true when Reviewer4 clicked the button, it would disable it. Would that affect anything else in your logic?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,668)