Advertisements

Archive

Posts Tagged ‘Notes to the Quote’

Adding “Notes” to the “Quote” progrmatically in CRM 2011

July 24, 2011 3 comments

//Instantiate ‘Entity’ and set the ‘LogicalName’ to “annotation”

Entity objNotes = new Entity();
objNotes.LogicalName = “annotation”;

//Set ‘Subject’ and ‘notetext (i.e.,Body)’ properties
objNotes.Attributes.Add(“subject”, ”—-Your Subject—”);
objNotes.Attributes.Add(“notetext”, “—Your notes text—”);

//Relate the note with ‘Quote’ using ‘EntityReference’

EntityReference refQuote = new EntityReference();
refQuote.LogicalName = “quote”;
refQuote.Id = quoteID;  //Quote GUID
objNotes.Attributes.Add(“objectid”, refQuote);

//Set “objecttypecode” property with “quote” objecttypecode (i.e.,1084)

//Refer http://technet.microsoft.com/en-us/library/ms955729.aspx for objecttypecode’s
objNotes.Attributes.Add(“objecttypecode”, 1084);

//Call CRMService ‘Create’ method

crmService.Create(objNotes);

Advertisements