We can set a column default value in the SharePoint list and document library but there’s one OOB feature only in the SharePoint document library using which we can set a column default value, based on folder/location, we want to create the row/list item in.
The usual way of setting column default value
- Go to library settings
- Click on the column you want to set the default value of
- Go to Additional Column Value >> Default value.
- You can set your default value in the form of plain text or calculated value over here. You can see the default value when the list item is created
Location-based column default value settings
- Go to library setting >> click on Column default value settings
- Click on the column you want to set the default value of.
- Now, create a new row item.
- Document1 was created before setting location-based default value so you can see the default value that we set at the list setting level.
BUT for Document2, you can see the value that we set in location-based settings.
NOTE:
- The location-based default value will always take precedence over the value set at the column level. If you haven’t set a location-based default value for a particular location/folder, then it will just inherit from one level above.
- So, when you create an item at the root level, you will have a different default value and when you go inside (e.g. Finance Folder in the above example) and create a list item, it will have a different default value. COOL Feature!!!
The background picture of the location-based default value
It is very important for us to know exactly how Microsoft SharePoint is keeping this setting in the background.
- Go your SharePoint designer and open your site
- Click on All Files from Left Navigation
- Click on your Document Library in which you have set the default values.
- Click on Forms.
- In this panel, you will find a file client_LocationBasedDefaults.html. Open it. I have modified the XML for better reading.
- As you can see, there are two different locations and they are having two different default values.
Conclusion:
When we are working in records management and relying on Human Inputs heavily, then we may end up getting some data-entry issues. At that time, setting default values can be very helpful.