web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Javascript to show web...
Power Apps
Answered

Javascript to show web resource icon for Choice value

(1) ShareShare
ReportReport
Posted on by 276

Needing some help.  I think I'm following this guidance (Add Icons To All Records Of A View Based On A Condition In Power Apps (c-sharpcorner.com)) but the icons aren't showing up on the View.  Can someone look at my screen captures to find the issue?

The priority choices that people will select from

damian_green23_0-1707614899883.png

The web resource images to display to the left of the text.

damian_green23_1-1707614971039.png

Each of the web resources has the same settings

damian_green23_2-1707615003047.png

The below shows the Java Script that is supposed to pull this together.  I've put arrows on the screen capture showing where I thought the data needed to be inserted into.  Then to the right, it shows where I'm implementing the code on a specific column on a View that uses that field.

damian_green23_3-1707615899167.png

When I Save and Publish all Customizations both here and at the app, I still don't have an icon on the priority field for the 2 values shown above.

damian_green23_4-1707616121570.png

 

I've also tried it this way and haven't figured out the trick.

Display custom icons alongside values in list views with Power Apps - Power Apps | Microsoft Learn

Categories:
  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @damian_green23 The problem is because you put the Web Resource script on the Event Grid of the Table instead of on the Active View so it doesn't load at all actually. You must link the Web Resource script on the Active View first. The Editable Grid on the Table is not the same as the Active View you are trying to actually put the script on, that's why it wasn't even working at all.


    Besides this there's some more issues.

     

    Your JS code is incorrect too and probably would fire an error, you should change the variable name to mia_priority instead of gender to match the name of the variable you use on the switch on .
    Also you need to lowercase p so mia.priority_Value not mia.Priority_Value. Because even after the above changes, the mia_priority is probably going to be undefined and so it still won't work otherwise until you change this.
    Even after all that above, you must use parseInt(mia.priority_Value) on the right side or even the switch will not work at all as it must be an integer and not a string.

    After all the above changes it should work now.

    See if this helps @damian_green23 

  • damian_green23 Profile Picture
    276 on at

    Thank you so much for detailed fixes. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard