Forum Discussion
Conditional formatting for item containing data
Can anyone tell me how I can hide several fields that are needed to be seen in a View in SharePoint but not when the user fills out the fields for a new item? I have borrowed some JSON to manipulate a view but when our users are inputting the criteria for the new item, I don't want them to see a few fields. Is there a way to do that? Thank you!
Beth_Culpepper Open an item on your list and select Edit Columns
Hover over the column you want to hide, click on the vertical dots, and select Edit conditional formula
Enter the formula and click save:
=if([$ID] >'0', 'true', 'false')That will hide the column on new but not from the views or on edit.
7 Replies
Beth_Culpepper If you want to hide columns from all list forms (new/display/edit), follow below steps:
- Go to the list & open any item to view the item details in the display form.
- At the top of the form, select Edit form > Edit columns.
- In the Edit columns pane, check (to show) or uncheck (to hide) the checkbox for the column or columns as needed.
- When you're finished, select Save.
Documentation: Show or hide columns in a list or library form
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Beth_CulpepperBrass ContributorI tried this first but this did not work for me. Thank you anyway! The response above worked perfectly.
Beth_Culpepper Open an item on your list and select Edit Columns
Hover over the column you want to hide, click on the vertical dots, and select Edit conditional formula
Enter the formula and click save:
=if([$ID] >'0', 'true', 'false')That will hide the column on new but not from the views or on edit.
PamDeGraffenreid I just tried using the code you provided and column is hidden from all the list forms (not just new form).
Previously [$ID] context was not available on the list forms. Does Microsoft added it recently?
I am getting below error message on developer tool console: ID was not found on the data object.
Please consider giving a Like if my post helped you in any way.
ganeshsanap Fair question... I tried using $ID because I saw another post recently where someone was able to to get it work. It is a supported column type with column formatting, and I don't see any exclusions listed here Show or hide columns in a list form | Microsoft Docs
Beth_Culpepper If you have problems with that at some point with checking the ID column, look for another condition that might work. Or jump back on, and we'll be happy to help you work out a condition that meets your requirements.
- Beth_CulpepperBrass ContributorBrilliant! This worked perfectly, Pam, thank you SO much!