Jul 30, 2013

Setting regarding object in JavaScript

When programmatically creating a task/activity, I found it is little tricky the way we need to assign regarding object. For the benefit of others, though of sharing the code snippet. I am using Ascentium CrmService for my client side operations.

var beEnt = new BusinessEntity("task");
beEnt.attributes["regardingobjectid"] = "F5E42F4A-8539-E011-8602-005056A61424"; //GUID of record
beEnt.attributes["regardingobjectid"].name = "ABC and Company"; //name of the record
beEnt.attributes["regardingobjecttypecode"] = "account"; //type of record
beEnt.attributes["subject"] ="sample subject";
beEnt.attributes["description"] = "Sample body";
oService.Create(beEnt);

No comments:

Post a Comment