locked
How to add a note to a case(incident) in crm 2011 . by using c# RRS feed

  • Question

  • hey guyz, im able to create case entities in crm 2011 using c#  from crm sdk..

    now i want to add note(annotations) to the cases.. how do i it?? can any one tell me im facing problems in it.


    Monday, October 15, 2012 2:10 PM

Answers

  • thanks , lattimer.. i was trying to use the code from the above link, but i was unable to find the assembly reference to the annotation class, later your second link explained me the reason of it :D.. anyhow im going with the below code, i guess it is simple and understandable (atleast for me).

    but i would sure like to take guidance from you on those early bound types some time later.. :)

    Entity noteEntity = new Entity("annotation");
                noteEntity.Attributes.Add("subject", "Let me clear you some concepts"); // title of the note
                noteEntity.Attributes.Add("notetext", "I want you to solve my issue not my neighbours issues it is totally unacceptable for me to accept the unacceptable response"); // description of note
                noteEntity.Attributes.Add("objectid", new EntityReference
                {
                    Id = ticketID, // guid of the ticket
                    Name = "incident"
                });
                noteEntity.Attributes.Add("objecttypecode",112); // 112 = object type code for Case(Ticekt) Entity
                _service.Create(noteEntity);

    • Marked as answer by SyedHaroon Tuesday, October 16, 2012 5:24 AM
    Tuesday, October 16, 2012 5:24 AM
  • Monday, October 15, 2012 2:22 PM
    Moderator

All replies

  • Monday, October 15, 2012 2:22 PM
    Moderator
  • thanks , lattimer.. i was trying to use the code from the above link, but i was unable to find the assembly reference to the annotation class, later your second link explained me the reason of it :D.. anyhow im going with the below code, i guess it is simple and understandable (atleast for me).

    but i would sure like to take guidance from you on those early bound types some time later.. :)

    Entity noteEntity = new Entity("annotation");
                noteEntity.Attributes.Add("subject", "Let me clear you some concepts"); // title of the note
                noteEntity.Attributes.Add("notetext", "I want you to solve my issue not my neighbours issues it is totally unacceptable for me to accept the unacceptable response"); // description of note
                noteEntity.Attributes.Add("objectid", new EntityReference
                {
                    Id = ticketID, // guid of the ticket
                    Name = "incident"
                });
                noteEntity.Attributes.Add("objecttypecode",112); // 112 = object type code for Case(Ticekt) Entity
                _service.Create(noteEntity);

    • Marked as answer by SyedHaroon Tuesday, October 16, 2012 5:24 AM
    Tuesday, October 16, 2012 5:24 AM
  • Hi,

    Below an working example, to attach an image:

    Entity annotation = new Entity("annotation");
            annotation.Attributes.Add("subject", "signature");

            annotation.Attributes.Add("filename", filename);
            annotation.Attributes.Add("documentbody", body);
            annotation.Attributes.Add("mimetype", "image/png");

            annotation.Attributes.Add("objectid", new EntityReference("account", new Guid(ACCOUNTID)));

            Guid annotationId = _service.Create(annotation);

    Kind Regards,

    Pedro Airo

    Wednesday, October 24, 2012 8:14 AM
  • Nice, thanks for help !
    Friday, February 10, 2017 2:25 PM