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)

Xrm.Navigation.openWebResource sample code

(0) ShareShare
ReportReport
Posted on by

Can anybody post a sample code using Xrm.Navigation.openWebResource .I need to pass parameters in the Data section of the below syntax.

Xrm.Navigation.openWebResource(webResourceName,windowOptions,data)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Psyionic Profile Picture
    195 on at

    Hi C Durvas,

    You can use the following code:

    var windowOptions = { openInNewWindow: true, height: 400, width: 400 }
    Xrm.Navigation.openWebResource("new_MyWebPage",windowOptions ,"myData");

    This will open your web resource (new_MyWebPage) in the new window and pass there text ("myData") as data parameter of the url string.

    If you want to pass multiple values or want to find out how to parse those values, you can find more information in this article.

    Best Regards,

    Oleksandr Olashyn

  • Suggested answer
    PranavShroti Profile Picture
    4,510 on at

    it should be simple: something like this.

    PASSING Value:

    Xrm.Navigation.openWebResource("new_webResource.htm",null,"dataItemValue");

    More information:

    docs.microsoft.com/.../openwebresource

    GETTING VALUE:

    function getDataParam() {

      //Get the any query string parameters and load them

      //into the vals array

      var vals = new Array();

      if (location.search != "") {

       vals = location.search.substr(1).split("&");

       for (var i in vals) {

        vals[i] = vals[i].replace(/\+/g, " ").split("=");

       }

       //look for the parameter named 'data'

       var found = false;

       for (var i in vals) {

        if (vals[i][0].toLowerCase() == "data") {

         parseDataValue(vals[i][1]);

         found = true;

         break;

        }

       }

       if (!found)

       { noParams(); }

      }

      else {

       noParams();

      }

     }

    More Info:

    msdn.microsoft.com/.../gg327945.aspx

    Regards,

    Pranav

    If found useful, please mark the answer as verified

  • Community Member Profile Picture
    on at

    I tried the same but not getting values.

    3324.Error.PNG

  • PranavShroti Profile Picture
    4,510 on at

    can you copy paste your code, so that we can also have a look.

    Regards,

    Pranav

  • Community Member Profile Picture
    on at

    var formData = { "UnitId": formContext.getAttribute(UNIT_LOGICAL_NAME).getValue()[0] };

    var windowOptions = { openInNewWindow: true, height: 700, width: 300 };

    Xrm.Navigation.openWebResource("new_abc.htm", windowOptions, formData);

  • Verified answer
    PranavShroti Profile Picture
    4,510 on at

    and if you pass hardcoded value, then also you are getting error?

    Regards,

    Pranav

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    Could you please check below reference  -

    var customParameters = encodeURIComponent("firstname=Ahmed&company=Magnetism Solutions Ltd.&title=CRM Developer");

    Xrm.Navigation.openWebResource("new_abc.htm",null, customParameters);

    https://www.magnetismsolutions.com/blog/ahmed-anwar's-blog/2015/05/26/opening-web-resources-in-xrm-utility-in-dynamics-crm-2015-online-update-1

  • Community Member Profile Picture
    on at

    I passed hard coded values .It worked.

    I took the Guid in variable and passed it in the parameter.

    Thanks all.

  • Suggested answer
    Vipin J Profile Picture
    1,603 on at

    Here is a complete example - How to pass and retrieve custom data to a WebResource in Dynamic 365 CRM

    https://vjcity.blogspot.com/2019/05/how-to-pass-and-retrieve-custom-data-to.html

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