How to retrieve notes and attachments from one entity and put that in another entity RRS feed

  • Question

  • Hi guys,

    I need to know how to retrieve notes and attachments from one entity and put that in another entity.

    for eg : i have two entities one is named as "CAR" and another is named as "BUS", the BUS entity has a lookup of CAR entity...

    when i select a record from CAR entity in BUS entity of CAR lookup, the notes/attachments present in that particular selected CAR entity record has to autopopulate notes/attachments in the BUS entity's notes/attachments.

    Is this is possible if means can anyone help me out in this guys...................

    Please its very urgent to me since i need to do this to one of my client and i have less time...........

    Please guys help me out in this...............

    Gopinath V.

    • Edited by Gopivino Friday, September 27, 2013 6:02 AM
    Friday, September 27, 2013 5:59 AM

All replies

  • Notes and attachment are stored with Annotation entity. Annotation have a attribute annotation.objectid which will have reference to record of object with which its associated.

    You should be able to achieve this through plugin. Register a plugin on update of CAR and when that lookup is set retrieve its associated notes\attachments. And than you can duplicate those and associate with BUS.

    More Information on Annotation Entity:


    Friday, September 27, 2013 8:24 AM
  • Hi,

    You could write a plugin for this.

    read all notes:

    public static EntityCollection GetAllNotes(Guid _ObjectId, IOrganizationService _service)
                EntityCollection results = null;
                    QueryExpression _Query = new QueryExpression
                        EntityName = "annotation",
                        ColumnSet = new ColumnSet(true),
                        Criteria = new FilterExpression
                            FilterOperator = LogicalOperator.And,
                          Conditions = 
                            new ConditionExpression 
                                AttributeName = "objectid",
                                Operator = ConditionOperator.Equal,
                                Values = { _ObjectId }
                    results = _service.RetrieveMultiple(_Query);
                catch (Exception Ex)
                return results;

    To create notes, just read returned EntityColletion using foreach and create the annotation record just change the objectid to current record id.


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Friday, September 27, 2013 8:34 AM
  • Hi Niraj,

    Thanks for your reply....

    Let me check and will let u know...

    Gopinath V.

    Friday, September 27, 2013 9:19 AM
  • Hi Vikram,

    Thanks dude for your reply....

    I will check and let you know...

    Will ask you if have any doubt....

    Gopinath V.

    Friday, September 27, 2013 9:30 AM