Forum Discussion

Chris_Boylan's avatar
Chris_Boylan
Copper Contributor
Mar 04, 2022

Sharepoint form list footer send email, field [$Start Time] (possible href)? issue

We're using a sharepoint calendar list and the JSON code in the footer sends an email based on values in the current record. It's partially working and so far I've been able to populate the email subject and body using href and can retrieve the field [$Title] - a string. However I've not been able to retrieve the value [$Start Time] which is a field of type date and not a calculated field.

 

[edit] found this to display a date in JSON but I couldn't get it to work inside the href 'block'

"txtContent": "=toLocaleString(@currentField)"

 

I'm not a developer so this is mostly cobbled together from around the internet and MS examples, thanks in advance 🙂

 

Chris

 

Here's the current code

 

 

 

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "children": [
        {
            "elmType": "span",
            "style": {
                "padding": "12px"
            },
            "txtContent": "='Email trainer: ' + [$Trainer] + ' with details for: ' + [$Title]"
        },
        {
            "elmType": "a",
            "attributes": {
                "iconName": "Mail",
                "class": "sp-field-quickActions",
                "href": {
                    "operator": "+",
                    "operands": [
                        "mailto:",
                        "[$Trainer]",
                        "?subject=WFD Training Calendar reminder for: ",
                        "[$Title]",
                        "&body=You are listed as trainer for the training event ",
                        "[$Title]",
                        " from ",
                        "[$Start Time]",
                        " to ",
                        "[$End Time]"
                    ]
                }
            }
        }
    ]
}

 

 

 

 

@sharepoint @JSON

 

No RepliesBe the first to reply

Resources