Articles

Show Hide Columns in SharePoint list forms conditionally

Show Hide Columns in SharePoint list forms conditionally

In this Article, We will see how show hide a column from list or libary forms in SharePoint conditionally in SharePont online. By the term SharePoint list and library forms I means new and edit form of list or libary.

It was much awated feature from Microsoft and now it is very easy to show hide columns in new and edit forms in SharePoint List event conditionally. So lets have a look on it quickly.

 

First lets have a look on how to show hide a column in SharePoint and then we will see how to show or hide the column on the basis of a condition.

 

Show hide columns from SharePoint list

 In order to show hide columns from SharePoint list or libarary forms follow below steps.

  1. Click on new form of list or libarary
  2. On the new form, Click on Edit forms and then click on Edit columns as shown in image below
Edit columns
 
Once you have clicked on edit columns, then uncheck the fields you do not want to show on new or Edit form.

Conditionally show or hide columns from sharepoint list or library form

Now lets suppose we want to apply a condition to show or hide the form then follow then we can apply a conditional formula for that. lets see step by step on how to apply conditional formula to show or hide columns from new or edit form of list or libarary in SharePoint.

 

To complete the example, I have created a SharePoint list with below columns

  1. Project (Single line of Text)
  2. Cost (Number)
  3. Approver (Person)

Lets suppose that we want to show the approvar field in new or edit form only when cost is greater than 500.

 

Below steps shows how to do this.

 

  • Go to new form of SharePoint list
  • Click on Edit form then Edit columns as per above image.
  • Just next to the columns, click on ... to show the menu as shown in image below and then select "Edit conditional formula" as shown in image below

Show or hide columns in SharePoint list or library conditionally

Paste below conditional formula

=if([$Cost]>500,'true','false')
This formula will return true if Cost entered in Cost field is greater 500 and field approver will be visible only when the formula returns true.
 

Writing conditional formula

In this section, lets see how to write conditional formula.

 

We just need to remember below points.

  1. To refer  to a field in the list, We need use [$FieldInternalName].
  2. Formula should return true or false value only. use if condition, first argument is the condition and condition will evaluate to second argument if condition is true other wise third argument.
  3. To compare person  type column, use some attrubute of person field like email  as below                                                                                                  
    =if([$PersonFieldInternalName].email=='abc@test.com','true','false')

  4. You can also compare DateTime fields just just Date function to convert string to date , for Example                                                                               

=if([$MyDateField]==Date('15/5/2020'),'true','false')

  5. You can also add / substract the value of fields before comparing, for example                                                                                                                           

=if([$MyField1]+[$MyField2]<500,'true','false')

                          

Supported field types for Conditional Formula

Not all field types in SharePoint Online lists are supported for conditional formulas. As of now the field types which are not supported are given below

  1. Person column with multiple selection
  2. DateTime column with time calculation
  3. Currency columns
  4. Location columns
  5. Calculated columns
  6. Managed Metadata columns

 


SharePoint Online

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Mukesh Tiwari
Always ready to learn new technologies, A problem solver, exhibit to do attitude. Having around 10+ years of experience of development and management skills. I believe don't just set random goals but right goals suited for you.
Page Views :    Published Date : Jul 29,2020  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!