Forum Discussion
Help with JSON format and SharePoint Column
I have a simple text column,
this stores name and upn in the following format:
firsName LastName <something1@domain>
sometimes its multiple users then it looks like (separated by semicolon and space)
firsName LastName <something1@domain>; firsName2 LastName2 <something2@domain>
I would like to hide the mail/upn from the list but manage its just:
firsName LastName
Or
firsName LastName; firsName2 LastName2
is that possible? Can someone advice/help
Sifiak Do you want to show it in one line? I think it is better and easy to show it on separate lines.
Also, you can add additional styling as per your requirements in style property.
Example: adding margin at the top like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "style": { "display": "block", "margin-top": "5px" }, "elmType": "div", "children": [ { "elmType": "div", "forEach": "person in split([$TextColumn],';')", "txtContent": "=substring([$person],0,indexOf([$person],'<'))" } ] }
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Sifiak Try using SharePoint JSON column formatting like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "style": { "display": "block" }, "elmType": "div", "children": [ { "elmType": "div", "forEach": "person in split([$TextColumn],';')", "txtContent": "=substring([$person],0,indexOf([$person],'<'))" } ] }
Where [$TextColumn] is an internal name of your Request column in SharePoint list in this format: [$InternalNameOfColumn]. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- SifiakCopper Contributorits almost great, i noticed that the names are below each other and somehow aligned to top, can they be centered vertically?
Sifiak Do you want to show it in one line? I think it is better and easy to show it on separate lines.
Also, you can add additional styling as per your requirements in style property.
Example: adding margin at the top like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "style": { "display": "block", "margin-top": "5px" }, "elmType": "div", "children": [ { "elmType": "div", "forEach": "person in split([$TextColumn],';')", "txtContent": "=substring([$person],0,indexOf([$person],'<'))" } ] }
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.