Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Can I change Custom Parameter of a Web Ressource with JS ?

(0) ShareShare
ReportReport
Posted on by 35

Hey,

Can I change Custom param of a Web Ressource with JS ?

Thank you !

*This post is locked for comments

  • Bas van de Sande Profile Picture
    Bas van de Sande 4,383 on at
    RE: Can I change Custom Parameter of a Web Ressource with JS ?

    Hi Yohan,

    a webresource is loaded into an iframe.

    In the Xrm.Page.getControl()  you specify the name of your control, in the setSrc you specify the url of the webresource. In that url you can pass querystring parameters.

    I presume you want to alter the parameters of a html webresource you loaded on the page.

    Bas

  • CU02081233-0 Profile Picture
    CU02081233-0 35 on at
    RE: Can I change Custom Parameter of a Web Ressource with JS ?

    Re,

    Yeah but It is not an iframe, it's a web ressource.

    Yohan

  • Suggested answer
    Bas van de Sande Profile Picture
    Bas van de Sande 4,383 on at
    RE: Can I change Custom Parameter of a Web Ressource with JS ?

    Hi Yohan,

    How about this:

    Xrm.Page.getControl("new_iframe").setSrc("http://www.stackoverflow.com");

    in the setSrc you control the url :)   e.g. append some querystring values

    Please let me know if this helps

    Bas

  • CU02081233-0 Profile Picture
    CU02081233-0 35 on at
    RE: Can I change Custom Parameter of a Web Ressource with JS ?

    Hi Bas,

    And thank you for your answer.

    No, as I said, I want to update the web ressource custom parameter in Javascript (OnLoad of the form for exemple), not manually.

    I never did that and I don't know if it is possible.

    Thanks

  • Bas van de Sande Profile Picture
    Bas van de Sande 4,383 on at
    RE: Can I change Custom Parameter of a Web Ressource with JS ?

    Hi Yohan,

    what do you mean with your question?

    do you mean, how to pass parameters to the webresource?

    in that case, what you also can do is to get the parameters from the main form

    You can get the values of the form fields into the webresource by just adding:

    window.parent. you get access to Xrm.Page.

    So all you have to do is:

    var formfieldValue = window.parent.Xrm.Page.getAttribute("CRMFieldSchemaName").getValue();

    Don't forget to place it within a javascript tag on the webresource:

    <script type="text/javascript">

     $(function () {

        var formfieldValue = window.parent.Xrm.Page.getAttribute("CRMFieldSchemaName").getValue();

     });

    </script>

    I hope this helps

    Bas

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans