Feb 18 2024 04:38 PM
Hi all. I have a JSON code on a Person column where I am trying to reverse the display name from Last name, First name to First Name Last name however the column is displaying the JSON code rather than executing and returning First Name Last name. Here is my JSON code:
Feb 18 2024 09:31 PM
Solution@MAVOTRP If you have fixed format of display names like Doe, John, use JSON like below:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(indexOf([$Scheduler.title], ',') != -1, substring([$Scheduler.title], indexOf([$Scheduler.title], ',')+2,indexOf([$Scheduler.title] + '^^', '^^')) + ' ' + substring([$Scheduler.title], 0, indexOf([$Scheduler.title], ',')), [$Scheduler.title])"
}
Where Scheduler is an internal name of your person or group column in SharePoint list in this format. You can get the correct 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.
Feb 18 2024 11:04 PM
Feb 18 2024 09:31 PM
Solution@MAVOTRP If you have fixed format of display names like Doe, John, use JSON like below:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(indexOf([$Scheduler.title], ',') != -1, substring([$Scheduler.title], indexOf([$Scheduler.title], ',')+2,indexOf([$Scheduler.title] + '^^', '^^')) + ' ' + substring([$Scheduler.title], 0, indexOf([$Scheduler.title], ',')), [$Scheduler.title])"
}
Where Scheduler is an internal name of your person or group column in SharePoint list in this format. You can get the correct 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.