This code makes that the outlook windows oppens automaticall when we press the “email” button and takes the email that has been saved in the “Kontakt” Field. We need to complete this code so when we press the button it automatically takes the subject for an email saved in another field. Is it possible with this json code?
{
"_comment": "A button to send an email",
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"attributes": {
"class": "ms-fontColor-black ms-fontColor-white--hover",
"title": "Send Email",
"href": "='mailto:' + [$Kontakt.email]",
"target": "_blank"
},
"style": {
"border": "none",
"cursor": "pointer",
"background-color": "transparent"
},
"children": [
{
"elmType": "div",
"attributes": {
"class": "ms-bgColor-greenLight ms-bgColor-green--hover ms-fontColor-black ms-fontColor-white--hover"
},
"style": {
"font-size": "16px",
"font-family": "arial",
"border": "1px solid Black",
"border-radius": "7px",
"padding": "3px 5px 3px 5px",
"box-shadow": "2px 2px #999"
},
"children": [
{
"elmType": "div",
"attributes": {
"iconName": "Mail"
},
"style": {
"display": "=if('Mail' != '','inline-block','none')",
"vertical-align": "middle",
"padding-right": "5px"
}
},
{
"elmType": "div",
"txtContent": "=if('' != '',' EMAIL',' EMAIL')",
"style": {
"display": "inline-block",
"font-family": "arial",
"vertical-align": "middle"
}
}
]
}
]
}
``
Expect to solve my problem
2
Answers
Yes, you can add to that to your href value.
Try something like:
Assuming you have another field named
EmailSubject
with column type as single line of text or multiple lines,You can change
href
property in your JSON like:Where
EmailSubject
is the internal name of your column. You can get the exact internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?For more information, check this Microsoft official documentation: Add an email action button to a field (advanced)
Check this documentation for supported properties inside
mailto
: How to Create Mailto Links