Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Display Header Record Image onto the Form

Posted on by 11,323

Hi,

I want to display whats ever in the header photo onto the form. I have the Web resource added to the form but i'm not sure what the code would look like. Any help?

8203.Screenshot_5F00_2.png

*This post is locked for comments

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Display Header Record Image onto the Form

    Hi Amey,

    This post is very old so i'm not sure why your image is fuzzy.

    Could be the actual resolution of the image itself or it could be fixed with some html/css magic maybe.

    I'm glad my code helped :)

  • AmeyHolden Profile Picture
    AmeyHolden 230 on at
    RE: Display Header Record Image onto the Form

    Thomas David Dayman

    Thanks for posting the code Thomas it was super helpful! How did you stop it coming out so fuzzy?

     instapost.png

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Display Header Record Image onto the Form

    If anyone wants the complete code:

    <html>
    <head>
        <style>
    
        </style>
        <script src="../WebResources/psd_/jquery_1.9.1.min.js"></script> 
        <script>
        function load() 
        {
            var imageUrl = window.parent.Xrm.Page.context.getClientUrl()+
        	"/image/download.aspx?attribute=entityimage&entity=" +
        	window.parent.Xrm.Page.data.entity.getEntityName() +
        	"&id="+window.parent.Xrm.Page.data.entity.getId() +
        	"&Timestamp="+ new Date().getTime();
        	
        	document.getElementById("customerAssetImage").src = imageUrl;
        }
        </script>
     <meta><meta><meta><meta></head>
    <body onload="load()" style="word-wrap: break-word;">
    
       <img src="nothing.jpg" id="customerAssetImage" name="customerAssetImage"/>
       
    </body>
    </html>


  • Verified answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Display Header Record Image onto the Form

    Hi,

    You can show entity image into web resource.

    using this URL you can get entity image

    var imageUrl = Xrm.Page.context.getClientUrl()+"/image/download.aspx?attribute=entityimage&entity="+ Your entity schema Name+"&id="+entity record Id+"&Timestamp="+ new Date().getTime();

    you can show this image using Iframe in web resource.

    Note: Image resolution and dimensions may be different.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans