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)

How to check which version of CRM I'm using with the Help of Javascript?

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    anilambadan Profile Picture
    1,160 on at

    I dont think we got any straightforward option to check the version using javascript.

    You may be able to use some logic from the following link

    stackoverflow.com/.../how-to-get-server-version-crm-2011-or-crm-2013-using-javascript

    thanks

    Anil

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    Actually there is no direct method to check this, but you can pick of some of the js methods which is added in new versions and some which is depreciated from older versions, similar to this: stackoverflow.com/.../how-to-get-server-version-crm-2011-or-crm-2013-using-javascript

  • Rajkumar Rajaraman Profile Picture
    on at

    There is no direct way to check this:

    Refer the following link:

    mileyja.blogspot.in/.../get-version-number-of-microsoft.html

    Hope this helps.

    Regards,

    R.Rajkumar

    "Please mark my answer as verified if you found it helpful"

  • Community Member Profile Picture
    on at

    Hi Rajkumar,

    i have tried that code.But it's Giving me some error ,will you help me out?

  • Rajkumar Rajaraman Profile Picture
    on at

    share the code here

  • Community Member Profile Picture
    on at

    if (typeof (SDK) == "undefined")

    { SDK = { __namespace: true }; }

    //This will establish a more unique namespace for functions in this library. This will reduce the

    // potential for functions to be overwritten due to a duplicate name when the library is loaded.

    SDK.SAMPLES = {

       _getServerUrl: function () {

           var OrgServicePath = "/XRMServices/2011/Organization.svc/web";

           var serverUrl = "";

           if (window.parent.Xrm.Page.data == null || window.parent.Xrm.Page.data == undefined) {

               _serverUrl = Xrm.Page.context.getClientUrl();

           }

           else {

               _serverUrl = window.parent.Xrm.Page.context.getClientUrl();

           }

           return serverUrl + OrgServicePath;

       },

       RetrieveVersionRequest: function () {

           var requestMain = ""

           requestMain += "<s:Envelope xmlns:s=\"schemas.xmlsoap.org/.../envelope\">";

           requestMain += "  <s:Body>";

           requestMain += "    <Execute xmlns=\"schemas.microsoft.com/.../Services\" xmlns:i=\"www.w3.org/.../XMLSchema-instance\">";

           requestMain += "      <request i:type=\"b:RetrieveVersionRequest\" xmlns:a=\"schemas.microsoft.com/.../Contracts\" xmlns:b=\"schemas.microsoft.com/.../Contracts\">";

           requestMain += "        <a:Parameters xmlns:c=\"schemas.datacontract.org/.../System.Collections.Generic\" />";

           requestMain += "        <a:RequestId i:nil=\"true\" />";

           requestMain += "        <a:RequestName>RetrieveVersion</a:RequestName>";

           requestMain += "      </request>";

           requestMain += "    </Execute>";

           requestMain += "  </s:Body>";

           requestMain += "</s:Envelope>";

           var req = new XMLHttpRequest();

           req.open("POST", SDK.SAMPLES._getServerUrl(), true)

           req.setRequestHeader("Accept", "application/xml, text/xml, */*");

           req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

           req.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../Execute&quot;);

           var successCallback = null;

           var errorCallback = null;

           req.onreadystatechange = function () { SDK.SAMPLES.RetrieveVersionResponse(req, successCallback, errorCallback); };

           req.send(requestMain);

       },

       RetrieveVersionResponse: function (req, successCallback, errorCallback) {

           if (req.readyState == 4) {

               if (req.status == 200) {

                   alert(req.responseXML.xml);

               }

               else {

                   errorCallback(SDK.SAMPLES._getError(req.responseXML));

               }

           }

       },

       _getError: function (faultXml) {

           var errorMessage = "Unknown Error (Unable to parse the fault)";

           if (typeof faultXml == "object") {

               try {

                   var bodyNode = faultXml.firstChild.firstChild;

                   for (var i = 0; i < bodyNode.childNodes.length; i++) {

                       var node = bodyNode.childNodes[i];

                       if ("s:Fault" == node.nodeName) {

                           for (var j = 0; j < node.childNodes.length; j++) {

                               var faultStringNode = node.childNodes[j];

                               if ("faultstring" == faultStringNode.nodeName) {

                                   errorMessage = faultStringNode.text;

                                   break;

                               }

                           }

                           break;

                       }

                   }

               }

               catch (e) { };

           }

           return new Error(errorMessage);

       },

       __namespace: true

    };

  • Community Member Profile Picture
    on at

    4456.error.png

  • Rajkumar Rajaraman Profile Picture
    on at

    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

  • Community Member Profile Picture
    on at

    i don't think just to rename namespace is going to do any good with the error

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