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

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

//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);

Advertisement
  1. Rohit
    August 8, 2011 at 6:23 PM

    Thanks a ton, this was wat i was looking for….

  2. qBaB
    December 2, 2013 at 2:22 PM

    How to get quoteID and crmService object?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: