Hide column on New Item form

SharePoint Online lists have forms for entering new items and editing items. Sometimes you want to hide a column on this type of form. In this blog I will demonstrate how you can hide a column on the New Item form via a Power Automate flow.

Inspiration

This question from EdwardHodson:

I’m creating fields/columns using REST API. I want some of them to not display in the default SharePoint form (but to be visible everywhere else, such as as a list column and in list settings, etc)

Power Users Community thread: Hide Fields using REST API?

Interface

Imagine you have a view with two columns. One is Title, the other one is TransferredToMasterLogTest.

originallist_hidecolumnfrom_newitemform

The default behaviour is that both columns will show up on the New Item form. But we only want to show the Title column in there.

You can change that via the interface.
1. Navigate to your list and click New Item
2. Click Edit Form icon
3. Select Edit columns
4. Unselect the columns you want to hide
5. Click Save

However, in this case we want to automate this again 🙂

ReorderFields method

Back in the my SharePoint on-premises days it was always possible to hide a column on a content type. After a network trace in my Developer toolbar I figured out that this is still a valid solution approach and even possible with a Send an HTTP request to SharePoint action.

You can use the ReorderFields method on a list item content type associated with your list and reorder your fields with an array in a POST request. If you leave one of the fields out of that array it will be hidden. This is obviously what we want! 🙂

Flow setup

This example below assumes you don’t have any custom list content types.

originallist_hidecolumnfrom_newitemform02

1. Add a Manually trigger a flow action.

manuallytriggeraflow

2. Add a Initialize variable action (optional).
This action is optional. You can also hard-code the name of the list in both URI field values of step 3 and 5.

originallist_hidecolumnfrom_newitemform03

a. Provide a Name, I used ListName
b. Select String as type
c. Provide a value. In this example our list is called ‘Test Hidden’

3. Add a Send an HTTP request to SharePoint action.
This action is to retrieve the GUID of the Content Type associated with the items in our list.

originallist_hidecolumnfrom_newitemform04

a. Select your preferred site in the Site Address
b. Use the GET method
c. Use the URI from the code snippet below

d. Use the Headers from the code snippet below

4. Add a second Initialize variable action (optional).
This action is optional. You can also directly add the expression in the action of step 5.

originallist_hidecolumnfrom_newitemform05

a. Provide a Name, I used ContentTypeId
b. Select String as type
c. Provide a value. In this case the expression from the code snippet below

5. Add a second Send an HTTP request to SharePoint action.

originallist_hidecolumnfrom_newitemform06

a. Select your preferred site in the Site Address
b. Use the POST method
c. Use the URI from the code snippet below

d. Use the Headers from the code snippet below

e. Use the Body from the code snippet below

That is it for the setup of this example.

After you run your flow your New Item form should only have the columns you defined in step 5e, like below.

fieldhidden

Happy testing!

You may also like...

2 Responses

  1. Pablo says:

    Been looking for a way to automate this for a while. Thanks!!!

  2. Dennis says:

    Hi Pablo,

    Thanks, great to hear this was useful for you 🙂

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.