Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Display a HTML webresource based on the lookup field selected.

Posted on by Microsoft Employee

Hi,

I am looking to display a HTML webresource in the CRM Lead form based on the Location(lookup) field selected. The HTML page called will be different for different locations. Is this possible in CRM?

Thanks.

*This post is locked for comments

  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Display a HTML webresource based on the lookup field selected.

    Hi Dinoop,

    Write the following javascript code on change of the location (lookup) field.

    function ChangeHtmlWebResource() {
        var webResourceControl = Xrm.Page.getControl("WebResource_Name");
        var location = Xrm.Page.getAttribute("locationid").getvalue()[0].name;
        if (location == "X") {
            webResourceControl.setSrc(null);
            webResourceControl.setSrc("XWebresourceURL");
        }
        else if (location == "Y") {
            webResourceControl.setSrc(null);
            webResourceControl.setSrc("YWebresourceURL");
        }
    }

    Hope this helps.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Display a HTML webresource based on the lookup field selected.

    Hi,

    all you need is a javascript event handler - attach it to the "OnLoad" of the form and to the "OnChange" of that lookup field. Then use setSrc method of your iframe control to load the web resource you need:

    Xrm.Page.getControl(<control name>).setSrc(<url>)

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans