Skip to content

Instantly share code, notes, and snippets.

@mrik23
Created February 3, 2018 09:50
Show Gist options
  • Save mrik23/31529a6e489a6d8e2d196f15a08c8ee4 to your computer and use it in GitHub Desktop.
Save mrik23/31529a6e489a6d8e2d196f15a08c8ee4 to your computer and use it in GitHub Desktop.
SharePoint Online JSON script to custom format a person column with a mailto link. This example shows how to convert a column date content to a string. The operators toString() or toLocaleString() could also be used, depending on the desired format output.
{
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"debugMode": true,
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding-right": "8px"
},
"txtContent": "@currentField.title"
},
{
"elmType": "a",
"attributes": {
"iconName": "EditMail",
"class": "sp-field-quickActions",
"href": {
"operator": "+",
"operands": [
"mailto:",
"@currentField.email",
"?subject=Check task status - ",
"[$Title]",
"&body=Please update your task status\r\n---\r\n",
"[$Title]",
"This task is due on: ",
{
"operator": "toLocaleDateString()",
"operands": [
"[$Date]"
]
},
"\r\nThanks."
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment