How to hide Microsoft Lists columns in forms conditionally
Microsoft Lists allows you to format the forms using JSON and also allows you to show/hide columns conditionally based on the data that is stored in the item.
In this article you will learn how the conditional formulas work and how you can add them to the to list columns individually.
If you are familiar with Excel you should know that conditional formulas use the same syntax used by spreadsheets, if you are not familiar with it you can check the example and explanation below.
A conditional formula starts with an equal signal followed by a condition and by the attributes true and false, which define the visibility for the column depending on the outcome of the condition. The condition must reference a column by its internal name, and a column being formatted can reference the column itself or any other column.
To apply conditional formatting to the form columns, you must do the following:
- Open the new item form or an item detail form and at the top of the form click in the edit form icon as illustrated in the following picture
- From the menu click on Edit columns
- Click on the vertical … to open the column context menu
- Click on Edit conditional formula
- In the pop-up window, type your formula
- Click on Save to apply the formula
A column formatted conditionally will be displayed disabled in the form list of columns as its visibility depends on the data.
In the example illustrated in this article, the column Extra Bags is only shown in the item detail form if the value if greater than 0, in the following animation you can see how it behaves with the condition is true and false.
Using this feature, you will not be showing data that despite being stored in the list is not relevant for an end user consulting information.