I am trying to create a link using JSON column formatting that helps users send an email (it's an anchor element with 'mailto'). The email parameters (the recipient and email body) need to contain certain values that come from lookup columns.
I have managed to do it using the following code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"margin": "10px",
"justify-content": "end"
},
"children": [
{
"elmType":"div",
"txtContent":"@currentField"
},
{
"elmType": "a",
"attributes": {
"target": "_blank",
"href": {
"operator": "+",
"operands": [
"mailto:",
"[$Engenheiro_x003a_E_x002d_mail]",
"?subject=",
"Testing Subject",
"&body=",
"[$Engenheiro_x003a_Engenheiro]"
]
},
"class": "ms-bgColor-themeLighter--hover ms-fontColor-themeDarker"
},
"style": {
"border-radius": "2px",
"justify-content": "center",
"text-decoration": "none",
"width": "32px",
"height": "32px",
"display": "flex"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "MailForward"
},
"style": {
"margin-top": "auto",
"margin-bottom": "auto",
"font-size": "16px"
}
}
]
}
]
}
The output is in the image below.
It works as intended when the user clicks the button rendered in the list view. However, if the user tries to click on it in the Form view, both values are shown as [object Object].
Even though the link works when activated from the list view, the ability to use this link inside the form would be really useful to the users of this list. Is there a way of working around this?
The company for which I work (in whose tenant the SharePoint site is hosted) currently does not allow the use of Power Automate or Power Apps.
[$Engenheiro_x003a_Engenheiro]
column? is it lookup OR person or group?[$Engenheiro]
column is a lookup column that points to a one-line text column. The[$Engenheiro_x003a_Engenheiro]
column is and additional column derived from that one and points to a one-line text column as well.