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 / Display Webresource Im...
Power Apps
Unanswered

Display Webresource Image depending on fields value

(0) ShareShare
ReportReport
Posted on by

Hello, 
I'm trying to display a WebResource depending on a field value (Choice value)  in a form, I've done this before without having issues. 
This time I noticed that the displayed image isn't saved after I save the new entity. That means as I open the entity previously saved, I have to manually change the field value to make the picture appear again. 

JSScript used is below to found. 


function onload(){
debugger;

var ContactType= Xrm.Page.getAttribute("FieldLogicalName").getSelectedOption();

if (ContactType != null){
Xrm.Page.ui.controls.get("WebResource_contactA").setVisible(false);
Xrm.Page.ui.controls.get("WebResource_contactB").setVisible(false);
Xrm.Page.ui.controls.get("WebResource_contactC").setVisible(false);
Xrm.Page.ui.controls.get("WebResource_contactD").setVisible(false);
Xrm.Page.ui.controls.get("WebResource_contactE").setVisible(false);
Xrm.Page.ui.controls.get("WebResource_contactF").setVisible(false);

if(ContactType.value==707570000){ // A
Xrm.Page.ui.controls.get("WebResource_contactA").setVisible(true);
}
else if (ContactType.value==707570001){ // B
Xrm.Page.ui.controls.get("WebResource_contactB").setVisible(true);
}
else if (ContactType.value==707570002){ // C
Xrm.Page.ui.controls.get("WebResource_contactC").setVisible(true);
}
else if (ContactType.value==707570003){ // D
Xrm.Page.ui.controls.get("WebResource_contactD").setVisible(true);
}
else if (ContactType.value==707570004){ // E
Xrm.Page.ui.controls.get("WebResource_contactE").setVisible(true);
}
else if (ContactType.value==707570005){ // Default
Xrm.Page.ui.controls.get("WebResource_contactdefault").setVisible(true);
}
}
}

 

Am I missing something ? 
Thank you

Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard