Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

MS CRM 365 on premise crm issue with loading webresource in html page

(0) ShareShare
ReportReport
Posted on by 600

Hi ,

Need your help to load javascript  file in HTML webresource. I have a premise 365 CRM. In a HTMl web resource I calling few javascript files. While I am giving hard coded values it is working fine. Want to change URL reference to dynamic. 

 <script  src="/myorg/{11111111111}/WebResources/tmylib.js" type="text/javascript"></script> -- this working.

But the problem is while moving from one org to another the values are changing. So wants to make it dynamic.

<script  src="../../tmylib.js" type="text/javascript"></script> -- not working

<script  src="../tmylib.js" type="text/javascript"></script> --not working

Also tried function specified in the below URL.

http://www.inogic.com/blog/2013/07/how-to-load-a-web-resource-using-java-script/ 

Please help on this.

Many thanks in advanced.

Bishnupriya

*This post is locked for comments

  • Verified answer
    Priya Swain Profile Picture
    600 on at
    RE: MS CRM 365 on premise crm issue with loading webresource in html page

    Hi Michel.

    Thanks for your help and time. The issue got resolved.

    My web resource name is like new_myHTML.html and new_myScript.js

    I was referring the JS file in the html web resource. The JS file was not able to find the correct path.

    I have tried the JS file reference in below ways. It is a on premise 365 CRM.

    1. <script  src="tvd_myScript.js" ></script> -- Did not work

    2. <script  src="../tvd_myScript.js" ></script> -- Did not work

    3. <script  src="../../tvd_myScript.js" ></script> -- Did not work

    4. <script  src="/myorg/{11111111111}/WebResources/ tvd_myScript.js" ></script> -- Worked as this is static values so I have replaced with below one.

    5. <script  src="../../../tvd_myScript.js" ></script> -- Worked

     

    Thanks,

    Priya

  • Michel van den Brink Profile Picture
    4,697 on at
    RE: MS CRM 365 on premise crm issue with loading webresource in html page

    Hello PriyaS,

    To best help you, could you share the names of your webresources? 

    These are the names I'm looking for, the ones in blue, under 'Name':

    webresourceexamples.png

  • Priya Swain Profile Picture
    600 on at
    RE: MS CRM 365 on premise crm issue with loading webresource in html page

    Hi Francesco and Michel,

    Thank you for your time.

    Tried as per your suggestion still it is not working.

    Thanks

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: MS CRM 365 on premise crm issue with loading webresource in html page

    Hi PriyaS,

    you dont need absolute url to any resource involved in your html page.

    Just use relative path like:

    • src="yourfile.js" if in same folder
    • src="myfolder/myfile.js" if in subfolder

    Hope it helps.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at
    RE: MS CRM 365 on premise crm issue with loading webresource in html page

    Hello,

    It looks like you are referring to the wrong depth level of the files. If you didn't use any slashes ( / ) in your HTML page name or JS file names, then they can be considered to be in the same folder.

    Also I see no publisher prefix, make sure to add that :-)

    For example if your script is called "new_tmylib.js" and your page is called "new_page.html", this should be just fine:

    <script src="new_tmylib.js"></script>

    Only if you used some kind of folder name in your HTML page or JS file names (e.g. "new_/Scripts/tmylib.js"), then you would need to use "../" to get into the right folder. 

    Sidenote 1: When referring to a web resource by it's URL, don't include the randomized number, always just refer to /WebResources/ to ensure the latest version and not a cached version.

    Sidenote 2: Including the 'type' attribute in a script tag is no longer required, conform the HTML5 spec. If you don't include a 'type', all browsers will assume it's JavaScript (ECMAScript)

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans