Forum Discussion

CJS81000's avatar
CJS81000
Copper Contributor
Feb 07, 2025

Re: SharePoint List - Select from a Choice Field and Display an Image

Rob, I followed your instructions & used your code (changing the dropdown references & image URLs to my own), but the images just show in the list up as empty boxes. Any thoughts? 

 

3 Replies

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    Make sure the images are stored on SharePoint, not externally. Other than that, without seeing your JSOn I can't tell if you've made an error.

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

    • CJS81000's avatar
      CJS81000
      Copper Contributor

      Thanks for the reply, Rob_Elliott. Here's my code:

       

      {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "children": [
          {
            "elmType": "img",
            "style": {
              "position": "relative",
              "top ": "50%",
              "left": "50%",
              "width": "24px",
              "height": "24px",
              "margin-left": "-50%",
              "margin-top": "0%"
            },
            "attributes": {
              "src": "=if(@currentField == 'Consistently Positive', 'https://MYCOMPANYNAME.sharepoint.com/:i:/r/sites/MYDEPARTMENTNAME/Shared%20Documents/_Resources/Trend%20Arrows/consistently%20positive%20trend%20(up%20arrow).png?csf=1&web=1&e=PalSfh', if(@currentField == 'Recently Positive', 'https://MYCOMPANYNAME.sharepoint.com/:i:/r/sites/MYDEPARTMENTNAME/Shared%20Documents/_Resources/Trend%20Arrows/recent%20positive%20trend%20(up-right%20arrow).png?csf=1&web=1&e=faw6kP', if(@currentField == 'Neutral','https://MYCOMPANYNAME.sharepoint.com/:i:/r/sites/MYDEPARTMENTNAME/Shared%20Documents/_Resources/Trend%20Arrows/neutral%20trend%20(right%20arrow).png?csf=1&web=1&e=YbDLiG', if(@currentField == 'Recently Negative','https://MYCOMPANYNAME.sharepoint.com/:i:/r/sites/MYDEPARTMENTNAME/Shared%20Documents/_Resources/Trend%20Arrows/recent%20negative%20trend%20(down-right%20arrow).png?csf=1&web=1&e=hk1MAM', if(@currentField == 'Consistently Negative','https://MYCOMPANYNAME.sharepoint.com/:i:/r/sites/MYDEPARTMENTNAME/Shared%20Documents/_Resources/Trend%20Arrows/consistently%20negative%20trend%20(down%20arrow).png?csf=1&web=1&e=CzakF5')))))"
            }
          }
        ]
      }

       

Resources