SharePoint referring to other column values

Tanvir, Abdullah (Contractor) 1 Reputation point
2020-10-20T13:09:29.343+00:00

Hi Everyone,

Below is the JSON code. I was trying to get the document file name in my email body. But it seems it doesn't work. Is there a way to get the document file name ?

JSON CODE

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding": "12px"
},
"txtContent": "@currentField.title"
},
{
"elmType": "a",
"attributes": {
"iconName": "Mail",
"class": "sp-field-quickActions",
"href": {
"operator": "+",
"operands": [
"mailto:",
"@currentField.email",
"?subject=Tags Not Applied &body=Hi, \n\nYou have not applied tags for the following file [$Name].\n\nRegards"
]
}
}
}
]
}

Outlook Output

Hi XYZ

You have not applied tags for the following file [$Name].

Regards

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,623 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Allen Xu_MSFT 13,821 Reputation points
    2020-10-21T10:03:44.02+00:00

    Hi @Tanvir, Abdullah (Contractor) ,

    You should replace column display name “Name” with internal name “FileLeafRef”.

    I modified your code and it worked fine in my end:

    {  
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
        "elmType": "div",  
        "children": [  
            {  
                "elmType": "span",  
                "style": {  
                    "padding": "12px"  
                },  
                "txtContent": "@currentField.title"  
            },  
            {  
                "elmType": "a",  
                "attributes": {  
                    "iconName": "Mail",  
                    "class": "sp-field-quickActions",  
                    "href": {  
                        "operator": "+",  
                        "operands": [  
                            "mailto:",  
                            "@currentField.email",  
                            "?subject=Tags Not Applied &body=Hi, \n\nYou have not applied tags for the following file: ",  
                                                            "[$FileLeafRef]",  
                                                            "\n\nRegards"  
                        ]  
                    }  
                }  
            }  
        ]  
    }  
    

    This is my test result:
    34053-8.png
    I hope this information has been useful, please let me know if you still need assistance.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.