Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

CRM 2013 JScript Update Contact Record

$
0
0

Respected Community Members,

 I have a requirement to Update Contact Field from JScript in CRM2013 where I am calling below function, but it doesn't work. The error says:- " SDK.JQuery.updateRecord requires the id parameter".

the alert displays the ContactId as GUID correctly. I also uploaded JSON2/JQuery1.4.1/SDK.JQuery.js and added that library into Contact form library.

Am I missing something here?? Please assist.

function updateContact(ContactId) {
try {
 var contact = {};
var customefieldvalue = new Date().toDateString();
contact.customefield = customefieldvalue ;
alert(contact);
alert(ContactId);
alert(customefieldValue);
 SDK.JQuery.updateRecord(
     ContactId,
     contact,"contact",
     function () {
      writeMessage("The contact record changes were saved");
      deleteContact(ContactId);
     },
     errorHandler
   );

 } catch (ex) { alert('JavaScript Error In updateContact:' + ex.description); }
}

function deleteContact(ContactId){
alert('delete contact');
}

function errorHandler(error) {
 writeMessage(error.message);
}

//Helper function to write data to this page:
function writeMessage(message) {
 $("<li>" + message + "</li>").appendTo(output);
}



Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>