How to customise the layout of your Microsoft 365 lists and forms without code
With Microsoft Lists and SharePoint's list formatting and configuration options we can customise the way columns, views, and add/edit forms are displayed without the need for custom code.
A SharePoint, Teams or Microsoft Lists is a collection of information that can be shared with people. This information consists of a set of elements with metadata. Each of these metadata or properties is stored in a column.
When a list is created, it has at least one associated view and forms for creating and modifying the items it contains. Views are ways of presenting the list information in the browser and are customisable. For example, you can filter items by date of creation or modify the columns displayed, either to enlarge or reduce the information.
Although the basic configuration of the lists allows customisation of views and forms, it is very common to develop custom code to suit clients' needs, both in terms of design and functionality. However, this is not always necessary. Knowing all the possibilities can save development time and make it easier for users to maintain.
Some customisations can be applied through column configuration options.
Others, where the presentation depends on the value of another column, are implemented through the use of conditional formulas.
Finally, other formats are implemented by constructing JSON objects that replace the default display.
It is this last point, a new feature of 365, whereby, following a defined structure, you can describe the HTML elements that are displayed when a field is included in a list view or a form and the styles that are applied to those elements.
Views are ways of presenting list information in the browser and are customizable
It is important to note that the formatting applied does not change the data, only how it is displayed.
Preparation of the example
To test this, go to Microsoft Lists and create a list with the template "Problem Tracking". We add these new columns:
Comments, of the type "Several lines of text". It will contain annotations on the task.
Solution, of type "Several lines of text". We want to make it mandatory to add a comment when the problem is solved.
Display, choice type.
Correction date of type "Date". We will make the internal name "CorrectionDate" by first creating it with this name and then modifying the name to "CorrectionDate".
Rearrange, show and hide columns
To arrange the information in a way that makes it easier to read and edit, it is sometimes necessary to adjust the order of the columns in the view or in the form. The steps for this sort order are as follows:
In the forms
Open the form by clicking on "New".
Select the column editing menu.
Drag the columns in the order you want to see them,
Mark or unmark the columns you want to be displayed. Note that if a column is mandatory, it cannot be unchecked.
In the views
In the views, these changes can be made via the context menu of the column. To change the order, it is also possible to drag the columns to the desired position.
Showing and hiding columns based on the content of other columns
In our example, when a problem is solved, we want to have more information about the solution. We will make the solution visible only when the status of the problem is "Completed". The correction date will also only be displayed when the status is "Completed".
For this we must use the conditional formulas and follow the steps below:
Open the form by clicking on "New".
Select the column editing menu.
In the context menu of the Solution column, click on "Edit conditional formula".
We include the formula =if([$Status] == 'Completed', 'true', 'false'). Remember that the column names in the formulas must be the internal names, which must be preceded by "$" and enclosed in square brackets. In the example, the internal name of the "Status" column is "Status".
We include the same formula in the correction date column.
You can see examples of conditional formulas according to field typeshere.
Modification of the form
By configuring the form we can describe how the header, footer and body structure will look like. In this case we have to apply the format using JSON objects.
In our sample list, there are fields related to the description of the problem, fields that expand on the information, and fields that allow us to follow up. With this in mind, it would be useful to group the fields into these sections that organise the fields. In addition, we will also modify the header to customise it with a new title and icon.
You can find all the necessary information about the structure of JSON objects and examples to start from here.
Headline
This time, from the menu shown in the "New" form, we will select the option "Configure design" and first of all we will configure the header.
We copy the JSON from the header section of the Microsoft page. Observe in the following image how, with a predefined structure, the HTML that will contain the header is being built. In this case, an icon and text with customised styles.
The text shall contain the word "Problem" and the title of the element. Notice that as the title changes, the heading changes as well. Any column of the element preceded by "$" and enclosed in square brackets can be used.
This is the difference between the default header and our modification:
Body
In the form design configuration, we choose the value "Text" from the drop-down menu. Remember, our aim this time is to make it easier to fill in, by grouping the information in the following categories:
Basic facts of the problem.
Monitoring data.
Further information.
We copy the JSON from the "Configure a custom body with one or more sections" section of the Microsoft page and modify it to suit our example:
Each section can have a title.
In "fields" we have to include the "display names" of all the columns to be included in the section.
We include an empty section that will contain other visible fields that have not been included in the other sections.
This is how our modified form looks like, which also has a responsive design.
Remember that the columns "Solution" and "Correction date" will be displayed when the status is "Completed".
If we repeat the steps of the column organisation, you will see that the sections are now also included:
Finally, we will validate that the data entered meet the following requirements:
The date of the notification may not be later than the day of.
The date of correction is equal to or greater than the date of notification.
We can include validations of the values of a column or of several columns of the form through the use of conditional formulas, which can be applied either to the validation of a column or to the whole form.
It is important to note that only list-level validation can be included, so the error message must be clear and include details of all validated data.
On our form
In the view, select "Edit" in the column "Notification date".
In "Column validation" we will include the formula "=DateReported<TODAY()". The error message will be "The notification date cannot be greater than the current day".
In the list settings> Validation settings, we include the formula "=[Date of correction]>=[Date of notification]" and the message "The date of correction must be equal to or greater than the date of notification. The date of notification cannot be later than the current day".
Once configured, when creating a new item with incorrect dates, validation messages will be displayed:
Modifying a view
As with forms, we can format a list view using the settings. In case not all cases are covered, we have the option to modify the associated JSON.
We can apply formatting to:
Columns.
Views. In this case, there are two types of design:
List layout: items are displayed as in a table.
Gallery layout: items are displayed in boxes.
In our example, we are going to make these modifications from the "Format current view" option:
1. Modify the "Status" column according to its value with colours and icons.
Accesses the modification of the format of the current view.
Click on "Apply formatting to columns".
Choose the "Status" column and under "Background colours" edit the styles:
Mark in red the whole item if the priority is "Critical" and it has been pending solution for more than 5 days:
Accesses the modification of the format of the current view.
Click on "manage rules" in the "Conditional Formatting".
Create the following rule:
With the options we have, we can't set the notification date to be less than Today minus a number of days, so in this case, we have to modify the JSON associated with the format.
Click on "Advanced mode" and modify the JSON to subtract 5 days from the notification date.
The view will now look like this:
Knowing the configuration possibilities of lists allows you to make the most of them to facilitate access to information and make it more attractive. It may, in many cases, avoid the use of code and make it maintainable by users.
Cookies on this website are used to personalize content and advertisements, provide social media features and analyze traffic. In addition, we share information about your use of the website with our social media, advertising and web analytics partners, who may combine it with other information you have provided to them or that you have collected from your use of your services. [+ info]
Select the cookies you want to accept
The necessary cookies help to make a website usable by activating basic functions such as browsing the page and accessing secure areas of the website. The website cannot function properly without these cookies.
[+info]
Name
Description
Type
Provider
com.cookies.table.life
COOKIE_SUPPORT
This cookie determines whether your browser accepts cookies.
HTTP
izertis.com
INGRESSCOOKIE
Records which pool is serving the visitor. This is used in relation to load balancing to optimize the user's experience.
HTTP
izertis.com
JSESSIONID
Preserves user states on all requests on the page.
HTTP
izertis.com
LFR_SESSION_STATE_20103
Cookie used by the web portal for session time control.
HTTP
izertis.com
Preference cookies allow the website to remember information that changes the way the page behaves or what it looks like, such as your preferred language or the region in which you are located.
[+info]
Name
Description
Type
Provider
com.cookies.table.life
GUEST_LANGUAGE_ID
Determines the language preferred by the visitor. Allows the web to set the preferred language in the visitor's re-entry.
HTTP
izertis.com
lang
Remember the language selected by a user with which to view a web page.
HTTP
ads.linkedin.com
Statistical cookies help website owners understand how visitors interact with web pages by collecting and providing information anonymously.
[+info]
Name
Description
Type
Provider
com.cookies.table.life
_ga
It records a unique identification that is used to generate statistical data about how the visit uses the website.
HTTP
izertis.com
_gat
Used by Google Analytics to control the rate of requests
HTTP
izertis.com
_gid
It records a unique identification that is used to generate statistical data about how the visitor uses the website.
HTTP
izertis.com
bounce
Determines whether a visitor leaves the website immediately - This information is used for internal statistics and analysis by the web operator.
Pixel
adnxs.com
cb
Collect information about the visitor's IP address, geographic location and navigation. This information is used for internal optimization and statistics for the web operator.
Pixel
pixel.prfct.co
cb
Collect information about the visitor's IP address, geographic location and navigation. This information is used for internal optimization and statistics for the web operator.
Pixel
pixel-geo.prfct.co
personalization_id
Set by Twitter - The cookie allows the visitor to share web content on their Twitter profile.
HTTP
twitter.com
seg
It records statistical data of visitor behavior on the web. This is used for internal analysis by the web operator.
Pixel
adnxs.com
seg
It records statistical data of visitor behavior on the web. This is used for internal analysis by the web operator.
Pixel
pixel-geo.prfct.co
Marketing cookies are used to track visitors on websites. The intention is to display relevant and engaging ads to the individual user, and therefore more valuable to publishers and third-party advertisers.
[+info]
Name
Description
Type
Provider
com.cookies.table.life
__ss
Marketing cookies are used to track visitors on websites. The intention is to display relevant and engaging ads to the individual user, and therefore more valuable to publishers and third-party advertisers.
HTTP
izertis.com
__ss_referrer
Collect information about visitor behavior on multiple websites - This information is used within the web to optimize the relevance of advertising. The cookie also helps determine how the visitor accesses the website.
HTTP
izertis.com
__ss_tk
Collect information about visitor behavior on multiple websites - This information is used within the web to optimize the relevance of advertising. The cookie also helps determine how the visitor accesses the website.
HTTP
izertis.com
_fbp
Used by Facebook to provide a number of advertising products such as real-time bidding from third-party advertisers.
HTTP
izertis.com
A3
Collect information about visitor behavior on multiple websites - This information is used within the web to optimize the relevance of advertising.
HTTP
yahoo.com
ads/ga-audiences
Used by Google AdWords to reconnect with visitors who have the potential to become customers, it is based on the customer's online behavior through the websites.
Pixel
google.com
anj
Registers a unique ID that identifies the device of a return user. Identification is used for specific ads.
HTTP
adnxs.com
bcookie
Registers a unique ID that identifies the device of a return user. Identification is used for specific ads.
HTTP
linkedin.com
bscookie
Used by the LinkedIn social networking service to track the use of embedded services.
HTTP
linkedin.com
cs
This cookie is used to improve the relevance of advertisements by collecting visitor data on multiple websites. This exchange of visitor data is usually offered by an exchange of advertisements or third-party data center.
Pixel
pixel-geo.prfct.co
d/px
Collects data from user preferences and behavior on the web - This information is used to produce content and advertising more relevant to a particular user.
Pixel
adsymptotic.com
fr
Used by Facebook to provide a number of advertising products such as real-time bidding from third-party advertisers.
HTTP
facebook.com
getuid
The audience manager configures this cookie to determine the time and frequency of visitor data synchronization. Synchronizing the data cookie is used to synchronize and gather visitor data from various websites.
Pixel
adnxs.com
i
It records anonymous user data, such as your IP address, geographic location, websites visited and which ads the user clicked, in order to optimize the display of ads based on the user's movement on websites that use the same ad network.
HTTP
openx.net
i/adsct
The cookie is used Twitter.com to determine the number of visitors accessing we b through Twitter advertising content.
Pixel
twitter.com
IDE
Used by Google DoubleClick to record and report user actions on the website after viewing or clicking on one of the advertiser's ads for the purpose of measuring the effectiveness of an ad and presenting user-specific ads.
HTTP
doubleclick.net
koitk
Used by Google DoubleClick to record and report user actions on the website after viewing or clicking on one of the advertiser's ads for the purpose of measuring the effectiveness of an ad and presenting user-specific ads.
HTTP
marketingautomation.services
lang
Set by LinkedIn when a web page contains an embedded Follow Us panel.
HTTP
linkedin.com
lidc
Used by the LinkedIn social networking service to track the use of embedded services.
HTTP
linkedin.com
lissc
Used by the LinkedIn social networking service to track the use of embedded services.
HTTP
linkedin.com
na_id
Used to recognize the visitor in his re-entry. This allows the website to record the visitor's behavior and facilitate the social media sharing feature provided by Addthis.com.
HTTP
addthis.com
ouid
Sets an identification string for a specific visitor. This is used to recognize the visitor in their re-entry. In addition, it allows the website to record the behavior of the visitor and facilitates the function of sharing on social networks provided by Addthis.com.
HTTP
addthis.com
pa_#_ts
Used on websites that use the same ad network to show ads to others to network nunciants.
HTTP
prfct.co
pa_uid
Used on websites that use the same ad network to show ads to other advertisers on the network.
HTTP
prfct.co
test_cookie
Used to check if the user's browser supports cookies.
HTTP
doubleclick.net
tr
Used by Facebook to provide a number of advertising products such as real-time bidding from third-party advertisers.
Pixel
facebook.com
uid
Creates a unique user ID generated by a machine. AddThis, which is propied ad from Clearspring Technologies, uses user identification to make it possible for the user to share content on various social networks by providing detailed statistics to various providers.
HTTP
addthis.com
usermap
Used to present the visitor with relevant content and advertising - The service is provided by groups of third-party advertising providers, who provide real-time offers to advertisers.
Pixel
pixel-geo.prfct.co
UserMatchHistory
Used to track visitors across multiple websites to present relevant advertising based on visitor preferences.
HTTP
linkedin.com
uuid2
Registers a unique ID that identifies the device of a return user. Identification is used for specific ads.
HTTP
adnxs.com
VISITOR_INFO1_LIVE
Intenta calcular el ancho de banda del usuario en páginas con vídeos de YouTube integrados.
HTTP
youtube.com
w/1.0/sd
Record visitor data such as your IP address, geographic location, and advertising engagement. This information is used to optimize advertising on websites that use OpenX.net.
Pixel
openx.net
YSC
Record a unique ID to maintain statistics of which YouTube videos the user has viewed.
HTTP
youtube.com
yt-remote-cast-installed
Records the user's video player preferences when watching embedded YouTube videos.
HTML
youtube.com
yt-remote-connected-devices
Records the user's video player preferences when watching embedded YouTube videos.
HTML
youtube.com
yt-remote-device-id
Records the user's video player preferences when watching embedded YouTube videos.
HTML
youtube.com
yt-remote-fast-check-period
Records the user's video player preferences when watching embedded YouTube videos.
HTML
youtube.com
yt-remote-session-app
Registra las preferencias del reproductor de vídeo del usuario al ver vídeos incrustados de YouTube.
HTML
youtube.com
yt-remote-session-name
Records the user's video player preferences when watching embedded YouTube videos.
HTML
youtube.com
li_sugr
Used by LinkedIn to track the use of embedded services. The main purpose of this cookie is: Targeting/Advertising.