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

If fx help

Hi

Struggling a bit with the syntax

I have a form, I would like to allow only a user selected in DatacardValue27_1 to be able to edit it, but if the form is completed, I've set it to go into View mode, but I cannot set the save button to disabled.

Currently on the Save Button DisplayMode property I have:

 

If(VarUser = DataCardValue27_1.Selected.Email, DisplayMode.Edit,DisplayMode.Disabled ||If(Form1.DisplayMode=DisplayMode.View, DisplayMode.Disabled, DisplayMode.Edit))

 

Issue with this is on an item which is set to DisplayMode.View the button is still clickable, although the form is in not editable even by the logged in user who is selected in the datacard (VarUser)

 

I've tried this also but get a red line error:

 

If(VarUser = DataCardValue27_1.Selected.Email, DisplayMode.Edit,DisplayMode.Disabled, If(Form1.DisplayMode=DisplayMode.View, DisplayMode.Disabled, DisplayMode.Edit))

 

I'd like the save button to be disabled even if the logged in user is the person selected in the datacard, IF the form has been set to ViewMode

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @G99 ,

I was in syntax modifying mode rather than code examination mode - I will add some foolproof code as well. I assume you have this on the DisplayMode of the button.

If(
   Form1.Mode = FormMode.View
   DisplayMode.Disabled
   If(
      VarUser = DataCardValue27_1.Selected.Email
      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

3 REPLIES 3
WarrenBelz
Super User III
Super User III

Hi @G99 

Try

If(
   VarUser = DataCardValue27_1.Selected.Email &&
   Form1.DisplayMode <> DisplayMode.View
   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.

Hi @WarrenBelz 

 

The same behaviour as I had with my fx, it sets the item to view mode, but the button stayed clickable and not disabled:

 

If(
    VarUser = DataCardValue27_1.Selected.Email &&
    Form1.DisplayMode <> DisplayMode.View,
    DisplayMode.Edit,
    DisplayMode.Disabled
   )

Hi @G99 ,

I was in syntax modifying mode rather than code examination mode - I will add some foolproof code as well. I assume you have this on the DisplayMode of the button.

If(
   Form1.Mode = FormMode.View
   DisplayMode.Disabled
   If(
      VarUser = DataCardValue27_1.Selected.Email
      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

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,216)