Programmatically add a note to a CRM entity

Back to Blog Listing

Notes are a simple CRM entity that can be added to most other entities in a one to many join.

An example of using the CRM API to add these programmatically to another entity is as follows. The "ObjectId" is the entity reference to the entity that will contain the note. This can be almost any entity in your CRM solution. In the example the entity type of the note being added is a Contact.

Dim note As New Annotation
   With note
       .Subject = "Sponsor Details"
       Dim sb As New StringBuilder("")
       sb.AppendLine("Sponsor Name: " & SponsorName & vbCrLf)
       sb.AppendLine("Sponsor MembershipNumber: " & SponsorMembershipNo & vbCrLf)
       sb.AppendLine("Sponsor Company: " & SponsorCompanyName & vbCrLf)
       sb.AppendLine("Sponsor Email: " & SponsorEmail & vbCrLf)
       .NoteText = sb.ToString
     End If
     Dim conRef As New EntityReference(Contact.EntityLogicalName, New System.Guid(contactGUID))
    .ObjectId = conRef
  End With

About the Author

James CTwo is our blogging alter ego for the Dynamics CRM and Web experts here at C2. We have a passion for anything CRM, Web Design or Social Media. We love writing about it! Find us on YouTube & Twitter.

comments powered by Disqus

Our White Papers

Discover the content that matters to you on business transformation. Explore how you can drive customer engagement, empower your team, optimise your businesses and revolutionise your products with the next digital revolution. For more information visit our white paper library.


C2 Newsletter

Our newsletter is sent on a quarterly basis, offering detailed insights into all aspects of business transformation with Microsoft cloud technologies. We also promote upcoming events and special offers throughout the year. Sign up to get involved today.

Dynamics 365 Office 365 Power BI Silver Partner