locked
update crm database using javascript. RRS feed

  • Question

  •  

    Hi friends! Is it possible to update the ms crm database using javascript?
    Monday, October 13, 2008 6:51 AM

Answers

  • Hi,

     

    You should never use it on the live system, it's not supported. The best way to update database is using crm web service. however the possibility is yes, see below example:

     

    Code Snippet

    var eml = document.getElementById("txtName").value;

    var cid = document.getElementById("crmExistingLookup").DataValue[0].id;

    var connection = new ActiveXObject("ADODB.Connection");

    var connectionString ="Provider=SQLOLEDB;Server=_db;Database=_mscrm;Integrated Security=SSPI";

    connection.Open(connectionString);

    var sql = "UPDATE FilteredContact SET emailaddress1='" + eml +"'WHERE contactid = '" + cid + "'" ;

    rs = new ActiveXObject("ADODB.Recordset");

    rs.Open(sql, connection, 1, 2);

    connection.Close();

     

     

     

    Cheers,

    Jim

    Monday, October 13, 2008 8:41 AM
    Moderator
  • Hi,

    You could make use of AJAX (async JS) to update the MSCRM database through a custom web service which in turn updates MS CRM through the SDK.

    Although I believe AJAX is still not officially supported by MS, your actual updates of the MS CRM database will be supported.

    Cheers,

    Karlo
    Monday, October 13, 2008 10:24 AM

All replies

  • Hi,

     

    You should never use it on the live system, it's not supported. The best way to update database is using crm web service. however the possibility is yes, see below example:

     

    Code Snippet

    var eml = document.getElementById("txtName").value;

    var cid = document.getElementById("crmExistingLookup").DataValue[0].id;

    var connection = new ActiveXObject("ADODB.Connection");

    var connectionString ="Provider=SQLOLEDB;Server=_db;Database=_mscrm;Integrated Security=SSPI";

    connection.Open(connectionString);

    var sql = "UPDATE FilteredContact SET emailaddress1='" + eml +"'WHERE contactid = '" + cid + "'" ;

    rs = new ActiveXObject("ADODB.Recordset");

    rs.Open(sql, connection, 1, 2);

    connection.Close();

     

     

     

    Cheers,

    Jim

    Monday, October 13, 2008 8:41 AM
    Moderator
  • Thanks Jim, i have one more doubt have u ever used outlook to track mails into crm.

     

    Monday, October 13, 2008 9:28 AM
  • Hi,

    You could make use of AJAX (async JS) to update the MSCRM database through a custom web service which in turn updates MS CRM through the SDK.

    Although I believe AJAX is still not officially supported by MS, your actual updates of the MS CRM database will be supported.

    Cheers,

    Karlo
    Monday, October 13, 2008 10:24 AM