How to: Hide fields in SharePoint list forms using PowerApps

Posted Thursday, November 16, 2017 10:39 AM by CoreyRoth

I’ve been building forms for a number of business processes lately using PowerApps and some of my tenants recently received the ability to customize forms in SharePoint lists using PowerApps.  One common scenario is that you might want to show or hide different fields depending on whether the user is creating a new item or editing an existing one.  I tried a number of approaches while experimenting with the visible field.  It wasn’t quite obvious to me at first, so after watching the following video that Chris Webb sent me a link for, I figured it out.

For our scenario, we have a simple travel request form. The requester will fill out fields on where they are going.  The approver will edit the form and fill in comments and mark it as approved.  The requester shouldn’t see these fields.  In this example, we could actually use Approval Flows and what not, but for this example we are keeping it simple.  Let’s start by looking at our default form.

Screen Shot 2017-11-16 at 10.25.25 AM

Start by selecting the field you want to hide and then click on the Visible property. 

Screen Shot 2017-11-16 at 10.26.42 AM

Now, set the value equal to the following formula.

If(SharePointForm1.Mode = FormMode.New, false, true)

Screen Shot 2017-11-16 at 10.29.06 AM

This hides the field when the form is in new item mode and shows it for view and edit.  You can customize this to your needs for other views as well.  You can preview what the form looks like in different modes now by clicking on SharePointForm1 and then changing the Default mode property between New and Edit.  For example, here is what my New form looks like now.

Screen Shot 2017-11-16 at 10.33.43 AM

Save and Publish your form and then you can try it from within SharePoint.  Now, when I click on the New button, the other fields are hidden.

Screen Shot 2017-11-16 at 10.35.46 AM

When I edit an existing item, we see the fields that we hid on the new form.

Screen Shot 2017-11-16 at 10.37.19 AM

Like many things in PowerApps, hiding fields is pretty simple once you know the right formula.  It took me a bit to figure this out because I think I was approaching this more from my developer background.  When I start to think about the old Excel formulas I used to use, it actually makes a lot of sense.

Comments

# re: How to: Hide fields in SharePoint list forms using PowerApps

Wednesday, December 13, 2017 11:44 PM by Ravi Kore

Very nice. Just one question as I am also in the process of selecting right custom form strategy .

Qn : If we want to hide and show fields on the form as per the logged in user present in SharePoint group.

If you have any idea on this then please share your opinion.

Thanks.

Leave a Comment

(required) 
(required) 
(optional)
(required)