How to read XML file in Dynamics CRM 2011 using Javascript

In Dynamics CRM 2011, we could maintain the XML files using web resource utility, which is a very good feature. It could be read using Javascript which is also maintained in the web resources of Dyanmics CRM 2011.You could make use of this feature when you want to populate some values dynamically.

Sample xml file –Settings.xml

<Configurations>
<Configuration id=”License”>54383-32343-213-22-2-21232-1222</Configuration>
<Configuration id=”Name”>Client 1</Configuration>
</Configurations>


Javascript sample code to read XML File:

var xmlPath = "../WebResources/Settings.xml";
 
var xmlnodePath = "//Configurations/Configuration";
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.preserveWhiteSpace = true;
xmldoc.async = false;
xmldoc.load(xmlPath);
var params = new Array();
var xmlnodelist;
xmlnodelist= xmldoc.selectNodes(xmlnodePath);
for (var i = 0; i < xmlnodelist.length; i++)
{
     params[i] = xmlnodelist(i).attributes[0].value;
}

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...