Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Passing option set values dynamically into Web Resource

Posted on by 826

Hi, 

        while changing the option set values i need to pass the selected value into Web Resource dynamically.

 have  anyone tried  it before or is this achievable?  

*This post is locked for comments

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Passing option set values dynamically into Web Resource

    Hi Ram,

     sure it is.. In the web resource, you can access form methods through window.parent

     So, define a function in the htmlweb resource:

    function onChangeValue(updatedValue)

    {

      ...

    }

     then, either in the body.onload for the html web resource.. or, possibly, just in the end of that html, do this:

     window.parent.AddWebResourceOnChange(onChangeValue);

     Finally, add a javscript web resource to your form:

    var onChangeHandler = null;

    function AddWebResourceOnChange(handler)

    {

     onChangeHandler = value;

    }

    function CallChangeHandler()

    {

     var updatedValue = Xrm.Page.getAttribute(...).getValue();

      onChangeHandler(updatedValue);

    }

    And add an event handler to the field (use CallChangeHandler function for that)

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Passing option set values dynamically into Web Resource

    Hi Ram,

    From the form you can set the parameter value "OnChange" of the option set value, that calls web resource function with parameter. Select the option set control in design view and use the change properties from the ribbon to set the parameter values from the even tab of change properties. (Change Properties => Events => On Change => Add Handler ("+"))

    Dynamic-Parameters.PNG

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