Hi,
I'm developing a code in which i need to know if the version i'm using is CRM 2011/13/15.
So anyone Help me out with some code.
*This post is locked for comments
Hi,
I'm developing a code in which i need to know if the version i'm using is CRM 2011/13/15.
So anyone Help me out with some code.
*This post is locked for comments
Here is the complete script to get the version of the CRM.Let me know if it doers not work..
function onload_Form() {
var xml = "" +
"<s:Envelope xmlns:s=\"schemas.xmlsoap.org/.../envelope\"><s:Body><Execute xmlns=\"schemas.microsoft.com/.../Services\" xmlns:i=\"www.w3.org/.../XMLSchema-instance\">" +
"<request i:type=\"b:RetrieveVersionRequest\" xmlns:a=\"schemas.microsoft.com/.../Contracts\" xmlns:b=\"schemas.microsoft.com/.../Contracts\">" +
"<a:Parameters xmlns:c=\"schemas.datacontract.org/.../System.Collections.Generic\"/><a:RequestId i:nil=\"true\"/>" +
"<a:RequestName>RetrieveVersion</a:RequestName></request></Execute></s:Body></s:Envelope>" +
"";
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("POST", Xrm.Page.context.getClientUrl() + "/XRMServices/2011/Organization.svc/web", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseText;
if (window.DOMParser) {
parser = new DOMParser();
xmlDoc = parser.parseFromString(resultXml, "text/xml");
}
else // Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(resultXml);
}
var crmVersion = xmlDoc.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[1].childNodes[0].nodeValue;
alert(crmVersion);
}
Dear Guido,
var version = 2011;
if (Xrm.Page.context.getIsAutoSaveEnabled !== undefined) { version = 2015; }
else { if (Xrm.Page.ui.setFormNotification !== undefined) { version = 2013; } }
Xrm.Page.context.getIsAutoSaveEnabled is not undefined in CRM2013 also
hi Guido,
Actually in my code,i was trying to get all the products which are active/Inactive using fetchXML.Now when I'm Testing My code on CRM 2015 i'm getting all the products
But in CRM 2015 Product have 4 status Active,Draft,Retired and Under Revision where In Crm 2011/2013 there are ony two i.e. Active & Inactive.So what i want to do is to get the version of CRM and accordingly set filter on my fetchXml
i don't think just to rename namespace is going to do any good with the error
Use this,
errorCallback(SDK.SOAPSamples._getError(req.responseXML));
instead of
errorCallback(SDK.SAMPLES._getError(req.responseXML));
Refer this also:
https://msdn.microsoft.com/en-in/library/gg594434.aspx
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156