Skip to main content
Community site session details

Community site session details

Session Id : +sBRk01WEpBj8/epK2zvvC
Power Apps - Building Power Apps
Unanswered

Display Webresource Image depending on fields value

Like (0) ShareShare
ReportReport
Posted on 26 Nov 2021 15:27:53 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:

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete