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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Passing parameters and open HTML web resource

(0) ShareShare
ReportReport
Posted on by

var accountPlanId=Xrm.Page.data.entity.getId();

var year=Xrm.Page.getAttribute("year").getValue();

var productTypeCode=Xrm.Page.getAttribute("producttypecode").getValue();

var accountId=Xrm.Page.getAttribute("accountid").getValue()[0].id

var priceListId=Xrm.Page.getAttribute("pricelistid").getValue()[0].id;



//var url= Xrm.Page.context.getClientUrl() + '/WebResources/productselector.html'

var url= Xrm.Page.context.getClientUrl() +'/WebResources/productselector.html?’+'accountplanid=’+ accountPlanId+'&year=’+year+’& producttypecode=’+ productTypeCode+’& accountid=’+ accountId+’& pricelistid=’+ priceListId

In above code I am passing the parameters to HTML web resources and forming the URL

.I am getting the all the fields values.but HTML page is not opening I guess some syntax error is there.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vipin J Profile Picture
    1,603 on at
    RE: Passing parameters and open HTML web resource

    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

  • Suggested answer
    Vipin J Profile Picture
    1,603 on at
    RE: Passing parameters and open HTML web resource

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

    vjcity.blogspot.com/.../how-to-pass-and-retrieve-custom-data-to.html

  • Suggested answer
    MilindP Profile Picture
    1,019 on at
    RE: Passing parameters and open HTML web resource

    if all the values are present in the parent form, you can get those values directly by using  window.parent.Xrm.Page.getAttribute("<att name>").getValue() instead of passing parameter

    below is snippet  you can add it in web resource

    <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

    <script type="text/javascript">

           document.onreadystatechange = function () {

               if (document.readyState == "complete") {

                   var message = document.createElement("DIV");

                   //message.innerHTML = "<a href='https://www.msn.com/&#39; target='_blank'>Name</a>"

                   message.innerHTML = "<a href='https://www.msn.com/&#39; target='_blank'>" + window.parent.Xrm.Page.getAttribute("name").getValue() + "</a>";

                   //setText(message, Description);

                   document.body.appendChild(message);

                   //alert(window.parent.Xrm.Page.getAttribute("name").getValue());

               }

           }

    </script>

  • MilindP Profile Picture
    1,019 on at
    RE: Passing parameters and open HTML web resource

    copy and create web resource using html code in msdn.microsoft.com/.../gg327945.aspx

    and call this web resource by passing your parameters and see if the web resource shows your parameters.

    if it works that means you are setting the correct parameters else some issue while extracting parameters in your web resource.....

  • Community Member Profile Picture
    on at
    RE: Passing parameters and open HTML web resource

    It is opening but non responsive error dialog coming .

    while debugging script customParameters

    var customParameters = encodeURIComponent("accountplanid=accountPlanId&year=year&producttypecode=productTypeCode&accountid=accountId&pricelistid=priceListId")

    customParameters variable values is coming as  below

    accountplanid%3DaccountPlanId%26year%3Dyear%26producttypecode%3DproductTypeCode%26accountid%3DaccountId%26pricelistid%3DpriceListId

  • Community Member Profile Picture
    on at
    RE: Passing parameters and open HTML web resource

    It is opening but non responsive error dialog coming .

    while debugging script customParameters

    var customParameters = encodeURIComponent("accountplanid=accountPlanId&year=year&producttypecode=productTypeCode&accountid=accountId&pricelistid=priceListId")

    customParameters variable values is coming as  below

    accountplanid%3DaccountPlanId%26year%3Dyear%26producttypecode%3DproductTypeCode%26accountid%3DaccountId%26pricelistid%3DpriceListId

  • Suggested answer
    MilindP Profile Picture
    1,019 on at
    RE: Passing parameters and open HTML web resource

    Try using

    ar url= Xrm.Page.context.getClientUrl() +'/WebResources/productselector.html?data=accountplanid=’+ accountPlanId +'&year=’ + year + ’&producttypecode=’ + productTypeCode +’&accountid=’+ accountId+’&pricelistid=’+ priceListId

    please notice after URL, using "data=<parameters>" and then extract the parameters in web resource

    see this https://msdn.microsoft.com/en-us/library/gg327945.aspx 

  • anilambadan Profile Picture
    1,160 on at
    RE: Passing parameters and open HTML web resource

    can you try to open the html file using

    var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");

    Xrm.Utility.openWebResource("new_webResource.htm",customParameters);

  • Community Member Profile Picture
    on at
    RE: Passing parameters and open HTML web resource

    with out patameters it is opening

    var url= Xrm.Page.context.getClientUrl() + '/WebResources/productselector.html'

    Not opening if has parameters

    var url= Xrm.Page.context.getClientUrl() +'/WebResources/productselector.html?accountplanid=’+accountPlanId

  • anilambadan Profile Picture
    1,160 on at
    RE: Passing parameters and open HTML web resource

    Try to remove all parameters and see whether its opening the url or not. if its opening try to add parameters one by one and  try to findout the issue

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans