{"id":853,"date":"2012-10-26T09:52:55","date_gmt":"2012-10-26T09:52:55","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=853"},"modified":"2012-10-26T09:52:55","modified_gmt":"2012-10-26T09:52:55","slug":"step-by-step-adding-configuration-page-in-solution-ms-crm-2011-part-2","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=853","title":{"rendered":"Step By Step Adding Configuration Page in Solution MS CRM 2011 Part -2"},"content":{"rendered":"<p>In my earlier <a href=\"http:\/\/mahenderpal.wordpress.com\/2011\/07\/26\/step-by-step-adding-configuration-page-in-solution-ms-crm-2011\/\">post <\/a>I have used a simple html web resource to set as configuration page and I found this post quite popular, so I thought to write another post on this. In this post I will show how can we get configuration details from xml web resource to display it in configuration page. We can use it in different way, but for the demo purpose I have kept it simple. You can follow below steps to show configuration data stored in xml web resource:<\/p>\n<p>1. Create a xml web resource where we can store our configuration information, for example our product registration information. I am using below xml in my\u00a0 new_Configuration.xml web resource<\/p>\n<p><strong>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<\/strong><br \/>\n<strong>&lt;Configuration&gt;<\/strong><br \/>\n<strong>\u00a0 &lt;RegisteredTo&gt;Mahender Pal&lt;\/RegisteredTo&gt;<\/strong><br \/>\n<strong>\u00a0 &lt;RegisterationID&gt;108837729827822&lt;\/RegisterationID&gt;<\/strong><br \/>\n<strong>\u00a0 &lt;Description&gt;This is a xRM Demo solution&lt;\/Description&gt;<\/strong><br \/>\n<strong>&lt;\/Configuration&gt;<\/strong><\/p>\n<p>2. Create a new html web resource and add below code to read data from our xml web resource<\/p>\n<p>&lt;HTML xmlns=&#8221;http:\/\/www.w3.org\/1999\/xhtml&#8221;&gt;&lt;HEAD&gt;&lt;TITLE&gt;xRM Demo&lt;\/TITLE&gt;<br \/>\n&lt;SCRIPT type=text\/javascript&gt;<br \/>\nfunction ShowConfiguration() {<br \/>\nvar Webresourceurl = WebResourceURL; \/\/we need to provide our xml webresource url here we can get it from CRM<br \/>\nvar nodePath = &#8220;\/\/Configuration&#8221;;<br \/>\nvar XmlDoc= new ActiveXObject(&#8220;Microsoft.XMLDOM&#8221;);<br \/>\nXmlDoc.preserveWhiteSpace = true;<br \/>\nXmlDoc.async = false;<br \/>\nXmlDoc.load(Webresourceurl);<br \/>\nvar nodelist;<br \/>\nnodelist = doc.selectNodes(nodePath);<br \/>\ndocument.getElementById(&#8216;registeredto&#8217;).value = nodelist[0].selectSingleNode(&#8220;RegisteredTo&#8221;).nodeTypedValue;<br \/>\ndocument.getElementById(&#8216;registerationid&#8217;).value = nodelist[0].selectSingleNode(&#8220;RegisterationID&#8221;).nodeTypedValue;<br \/>\ndocument.getElementById(&#8216;description&#8217;).value =\u00a0 nodelist[0].selectSingleNode(&#8220;Description&#8221;).nodeTypedValue;<br \/>\n}<br \/>\n&lt;\/SCRIPT&gt;<\/p>\n<p>&lt;META charset=utf-8&gt;&lt;\/HEAD&gt;<br \/>\n&lt;BODY onload=ShowConfiguration() contentEditable=true bgColor=#6666ff&gt;<br \/>\n&lt;P&gt;&lt;FONT size=6 face=&#8221;Tahoma, Verdana, Arial&#8221;&gt;&lt;FONT color=#ffffff&gt;&lt;STRONG&gt;Product Registertion Information&lt;\/STRONG&gt;&lt;\/FONT&gt;&amp;nbsp;&lt;\/FONT&gt;&lt;\/P&gt;<br \/>\n&lt;HR&gt;<\/p>\n<p>&lt;TABLE&gt;<br \/>\n&lt;TBODY&gt;<br \/>\n&lt;TR&gt;<br \/>\n&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color=#ffffff&gt;Product Registered To :&lt;\/FONT&gt;&lt;\/STRONG&gt;&lt;\/TD&gt;<br \/>\n&lt;TD&gt;&lt;INPUT style=&#8221;BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BACKGROUND-COLOR: #6666ff; COLOR: #ffffff; FONT-SIZE: 12px; BORDER-TOP: medium none; FONT-WEIGHT: bold; BORDER-RIGHT: medium none&#8221; id=registeredto TD &lt;&gt;&lt;\/TD&gt;<br \/>\n&lt;TR&gt;<br \/>\n&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color=#ffffff&gt;Registration ID :&lt;\/FONT&gt;&lt;\/STRONG&gt;&lt;\/TD&gt;<br \/>\n&lt;TD&gt;&lt;INPUT style=&#8221;BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BACKGROUND-COLOR: #6666ff; COLOR: #ffffff; FONT-SIZE: 12px; BORDER-TOP: medium none; FONT-WEIGHT: bold; BORDER-RIGHT: medium none&#8221; id=registerationid TD &lt;&gt;&lt;\/TD&gt;<br \/>\n&lt;TR&gt;<br \/>\n&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color=#ffffff&gt;Product Description :&lt;\/FONT&gt;&lt;\/STRONG&gt;&lt;\/TD&gt;<br \/>\n&lt;TD&gt;&lt;INPUT style=&#8221;BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BACKGROUND-COLOR: #6666ff; COLOR: #ffffff; FONT-SIZE: 12px; BORDER-TOP: medium none; FONT-WEIGHT: bold; BORDER-RIGHT: medium none&#8221; id=description size=40 TD &lt;&gt;&lt;\/TD&gt;&lt;\/TR&gt;&lt;\/TBODY&gt;&lt;\/TABLE&gt;&lt;\/BODY&gt;&lt;\/HTML&gt;<\/p>\n<p>3. Set your html web resource in configuration page lookup in solution and save it.<\/p>\n<p>Now when you will try to click configuration page you should get it like below<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/10\/productinfo.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-855\" title=\"ProductInfo\" alt=\"\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/10\/productinfo.png?w=300\" height=\"93\" width=\"300\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my earlier post I have used a simple html web resource to set as configuration page and I found this post quite popular, so I thought to write another post on this. In this post I will show how can we get configuration details from xml web resource to display it in configuration page. We can use it in&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=853\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[46,107],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/853"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}