Forum Discussion
JSON column formatting - get user's phone number from people column
- Sep 13, 2023
Tamras1972 Unfortunately, SharePoint JSON formatting does not support fetching phone number of users from person or group columns. It only supports below properties(with example values):
{ "id": "122", "title": "Kalya Tucker", "email": "email address removed for privacy reasons", "sip": "email address removed for privacy reasons", "picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822", "department":"Human Resources", "jobTitle":"HR Manager" }
So, try this:
- Create a new column for phone/contact number
- Customize list form using Power Apps and update the phone/contact number automatically from Power Apps based on user selection in people field - using the formula you posted above
- Then apply JSON column formatting like below for you for phone/contact number:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "span", "style": { "display": "block", "color": "#333333", "text-align": "left", "font-size": "16px", "font-weight": "bold", "padding-top": "10px", "padding": "0 4px" }, "attributes": { "iconName": "Phone" } }, { "elmType": "a", "txtContent": "@currentField", "attributes": { "target": "_blank", "href": "='https://teams.microsoft.com/l/call/0/0?users=' + @currentField" } } ] }
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.
Tamras1972 Unfortunately, SharePoint JSON formatting does not support fetching phone number of users from person or group columns. It only supports below properties(with example values):
{
"id": "122",
"title": "Kalya Tucker",
"email": "email address removed for privacy reasons",
"sip": "email address removed for privacy reasons",
"picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822",
"department":"Human Resources",
"jobTitle":"HR Manager"
}
So, try this:
- Create a new column for phone/contact number
- Customize list form using Power Apps and update the phone/contact number automatically from Power Apps based on user selection in people field - using the formula you posted above
- Then apply JSON column formatting like below for you for phone/contact number:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"display": "block",
"color": "#333333",
"text-align": "left",
"font-size": "16px",
"font-weight": "bold",
"padding-top": "10px",
"padding": "0 4px"
},
"attributes": {
"iconName": "Phone"
}
},
{
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "='https://teams.microsoft.com/l/call/0/0?users=' + @currentField"
}
}
]
}
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.