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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

to reference HTML webresource in Javascript webresource

(0) ShareShare
ReportReport
Posted on by 550

Hi,

I need to reference an html webresource inside a javascript that is related to an entity. 

-I created a HTML web resource named AccountsDropDowntoCheckbox.html

-I didnt add the web resource to my form..(I am not sure if I have to add the html webresource to the form when referencing to another javascript)

parent.Xrm.Page.getControl("WebResource_AccountsDropDowntoCheckbox.html").getObject().contentWindow.window.ConvertDropDownToRadiobuttonList();
But i am getting an error in the below line ..showing the Xrm.Page.getcontrol is null.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Thomas David Dayman Profile Picture
    11,323 on at

    What you could do is add a Web resource to the form which references the HTML you added to CRM.

    1731.Screenshot_5F00_1.png

    Instead of having 2 separate web resources (1 HTML and 1 JavaScript) You could just add the JavaScript to your HTML and so everything is in one resource.

    And maybe you can add parent.Xrm.Page.getControl?

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi

    As told by Thomas Dayman, you need to add the HTML web resource in the form.

    Go to Form Editor. Navigate to Insert tab and click on the Web Resource button in the command bar.

    0285.2.PNG

    You could select the required HTML web resource in CRM in the Web Resource look up marked in red below.

    Also, give a suitable name and label for the HTML Web resource added in the form.

    0285.2.PNG

    Then you can use the following code in Javascript to reference the HTML Web Resource added in the form.

    parent.Xrm.Page.getControl("WebResource_YourWebResourceName");

    Note that WebResource_YourWebResourceName is the Name in the Field Name and Properties section in the Add Web Resource window above.

    Hope this helps.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans