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

Disable field on start

I am not sure how to go about doing this.  There is a field on my form called "Is Submission an IIN" and this is a Yes/No field.  If users select No for this field the only thing they have to do next is submit the form.  I would like if a user selects No and submits the form, when they reopen the form both the Is Submission an IIN field and the submit button are disabled.  However, if an admin of the application opens the form, they should be able to edit those fields.

 

I have this formula on the DisplayMode for another field "Investigation Status" on the form which allows only admins to make a selection from the field but disables it for all other users.:  If(IsBlank(LookUp('IIN Admins', Admins.DisplayName = varUser.FullName, Admins.DisplayName)),DisplayMode.Disabled,DisplayMode.Edit)  - this formula works well but the scenario is slightly different.  In paragraph 1 above I would like a similar concept but only when the Is Submission an IIN field is set to No and submitted by the user, disable it and the submit button if they try to open the form again to make a change, but enable the field for the admins only.  Hope this is clear.  Thanks.

 

 

3 REPLIES 3
CNT
Super User
Super User

@joshieboy What's the list/table name where he field "Is Submission an IIN" is located? What is the Items property for u'r form?

@CNT - the list name is Initial Incident Notification and the items property for the form is LookUp('Initial Incident Notification',ID=EditFormID)

@ If you want to repeatedly check if the current user is an Admin, it is better to collect that information in the OnStart of the App,

Set(gblAdmin, If(IsBlank(LookUp('IIN Admins', Admins.DisplayName = varUser.FullName, Admins.DisplayName)),false,true)

For the DisplayMode for the Submit Button you can have,

 If('Initial Incident Notification'="No"
	If(gblAdmin, DisplayMode.Edit,DisplayMode.Disabled
	)
 )

In the DisplayMode for the "Is Submission an IIN" Field,

submitButton.DisplayMode

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,908)