Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Automatically transfer attachments (notes) from Order to Project

Posted on by 1,320

Our process automatically creates the Project record when an order is submitted. Is there a way to automatically create/transfer any attachments on the Order record to the Project when it is created? 

*This post is locked for comments

  • Suggested answer
    Felippe Profile Picture
    Felippe 796 on at
    RE: Automatically transfer attachments (notes) from Order to Project

    You can do this transfer or creation with a plugin STEP imediatelly after the project record was created:


    Guid idOrder ="<PUT the context Order GUID>";
    Guid idProject = "<PUT the context Project GUID>";
    EntityCollection notesFromOrderToProject =  GetAnnotations(idOrder); 
    if(notesFromOrderToProject!=null){

    foreach(var note in notesFromOrderToProject.Entities){

    Entity annotation= note;
    annotation["objectid"] = new EntityReference("<project_entityname>", idProject);

      Guid _annotationId = _service.Create(annotation);

    }

    }



    public EntityCollection GetAnnotations(Guid idOrder)
    {
    QueryByAttribute getAnnotation= new QueryByAttribute("annotation");
    getAnnotation.ColumnSet = new ColumnSet(true);
    getAnnotation.Attributes.AddRange("objectid");
    getAnnotation.Values.AddRange(idOrder);
    EntityCollection annotationsList= _service.RetrieveMultiple(getAnnotation);

    if (annotationsList.Entities.Count > 0)
    return annotationsList;

    return null;

    }



    If this solves, please Like an mark as "Verified Answer"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans