Adding custom hover text using json to a MS List column

00100627 20 Reputation points
2025-01-16T10:05:52.3666667+00:00

I found the below code online, and it is just what I've been looking for for some time. The problem I'm having with code is that if I change the name of the column to something other than "Description" the hover action won't work. It only works if the column is named "Description" which I need to change to something else like notes or best in non-English characters. Please help me figure out what to do.
Thanks

{ "elmType": "div", "style": { "font-size": "12px" }, "txtContent": "@currentField", "customCardProps": { "formatter": { "elmType": "div", "txtContent": "[$Description]", "style": { "font-size": "12px", "color": "green", "padding": "5px" } }, "openOnEvent": "hover", "directionalHint": "bottomCenter", "isBeakVisible": true, "beakStyle": { "backgroundColor": "white" } } }

Microsoft 365 and Office | Development | Office JavaScript API
Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | SharePoint | Development
{count} votes

Answer accepted by question author
  1. Xyza Xue_MSFT 30,241 Reputation points Microsoft External Staff
    2025-01-17T02:20:20.2666667+00:00

    Hi @00100627 ,

    You need to use the internal name of the column in your json code.

    How to fetch the internal name of a field from UI:

    Go to List settings >> Columns >> Click the column name >> See the internal name at the end of the URL(after ...Field=).

    For example(See the screenshot below), the internal name of the field I got from after Field= is bestin.(Omit spaces)

    User's image

    Result:

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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