SharePoint list Column formatting with PnP (Patterns and Practices) scripts

Just started learning and working with PnP scripts, great time savers!!!!….

In many projects we were been asked by customer to display the list data in a user friendly, understandable format which we would have achieved using round works and some open source scripts

But now no more such worries and pain, as SharePoint Pattern and Practice (SP PnP) scripts in GitHub really makes my job easy. GitHub has many formatting samples in the below just grab it whenever required. Just a copy and paste.

https://github.com/SharePoint/sp-dev-list-formatting/tree/master/column-samples

No code development, no wasting time and easy to implement these PnP scripts using SharePoint’s Column formatting feature

It’s time to start a sample formatting which loved. Below is a custom list I have in my new modern sharepoint site. It’s my worldwide accounts team contact list where I have Team member name, Email ID and Phone number

What I am going to try? I want to see the country flag for each country code which helps me to see where my accounts team members are geographically located.

How to do it? I am going to use the SharePoint PnP script readily available in the below GitHub site

https://github.com/SharePoint/sp-dev-list-formatting/tree/master/column-samples/text-startswith-callingcodes

Copy the JSON code as in the page below

Come back to the Team Contacts list –> Go to column “Phone Number” —> Column settings –> Format this column

A side formatting panel appears, paste the JSON code into it and click preview to see the change. Once happy click on “Save” until that the code is not saved.

Finally close the side formatting panel.

That’s a wow, really simple, catchy..

Next one more script of I wanted to add to my contact list is the “Gender” formatting

I want to show a kind of symbol to differentiate male and female. Because in most places we work with multivendor teams where we might not sure about the person on the other side, are they man or women. So thought of this could help me to distinguish the gender.

https://github.com/SharePoint/sp-dev-list-formatting/tree/master/column-samples/generic-svgicon-format

Oh.. ohh…. A blue boys and pink girls. Is that not easy. There are many formatting scripts available, make use of it hope its grows.

Thanks for SharePoint PnP contributors team and GitHub Team.