cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Luka84
Helper V
Helper V

Lock a form based on User

Good day,

I would like to lock a form from being edited based on the user

Tried entering the below formula but doesn't seem to work - Not sure why

It worked for the "Visible" property but this is not what I am trying to achieve, my goal is to keep it visibile but only allow specific people to edit it

 

Formula used on the "DefaultMode" property of the form

 

If((User().Email="ABC@Email.com"),FormMode.Edit, FormMode.View)

 

 

Screenshot for reference:

form edit.png

 

Thanks in advance

Luka

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Luka84 

 

Can you please more details about the scenario this is not working as expected? I carried out a test on side and when an item is opened for edit, this works fine but when I was trying to add a new item, this initiated to a new form form.
 
If you wish to set this to View for certain users, I would recommend you to apply this if logic in the "OnNew", "OnEdit","OnView" itself because the properties passed as form inputs are taken at a priority.
 
Please share more details on the expected behavior and we can work together to get the formula in place.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
Luka84
Helper V
Helper V

@yashag2255 , perhaps you can help 😃 

Hi @Luka84 ,

I've tested your formula and found it is right.

However, please notice one thing: capitalization.

Using the operator of "=" will case sensitive.

So try this formula:

If(Lower(User().Email)=Lower("....@....com"),FormMode.Edit,FormMode.View)

This works for me.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Luka84 

 

Can you please more details about the scenario this is not working as expected? I carried out a test on side and when an item is opened for edit, this works fine but when I was trying to add a new item, this initiated to a new form form.
 
If you wish to set this to View for certain users, I would recommend you to apply this if logic in the "OnNew", "OnEdit","OnView" itself because the properties passed as form inputs are taken at a priority.
 
Please share more details on the expected behavior and we can work together to get the formula in place.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Spot on !!

I added the formula to the OnEdit property of my SharePointIntegration and it worked like a cham 😃

Thank you so much for your help

 

Formula for reference:

Refresh('CASH APPROVAL'); EditForm('02.USER'); EditForm('01.HEADER') ; EditForm('04.SERVICES'); If((User().Email="abd@email.com"),EditForm('03.CASHIER'),ViewForm('03.CASHIER')); Navigate(OVERVIEW, ScreenTransition.None)

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,535)