Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Copy email from one entity to another

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I'm writing a plugin (C#) to copy notes and emails from leads to opportunities. The notes part workd but I can't find any way to copy the emails from the lead to the opportunity.

- When I try to fetch the email and then create a new one, I get a duplicate record-error.

- if I try to copy the activitypointer (for that email) then I get "Create' method does not support entities of type 'activitypointer'"

Can anyone tell me how I can copy the emails of a lead to an opportunity? Or link the same email to both entities would also be ok.

 

Thanks in advance,

Kind regards,

Erik

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Copy email from one entity to another

    Hi Erik,

    Is it CRM Online? Are you tring to create emails on lead qualify to opportunity? If yes then you dont need a plugin as this is an out of box functionality.

    Hope this helps.

  • erhan.keskin Profile Picture
    2,253 on at
    RE: Copy email from one entity to another

    Hi,

    How do you copy the email? You need to create Activity Parties and assign the existing one's values.For Instance;

    Entity email = new Entity("email");
    Entity fromParty = new Entity("activityparty");
    Entity toParty = new Entity("activityparty");

    toParty["partyid"] = new EntityReference(entityname, entityid); [EntityReference of existing email's "to"]
    fromParty["partyid"] = new EntityReference("systemuser", userid);   [EntityReference of existing email's "from"]
    email["from"] = new Entity[] { fromParty };
    email["to"] = new Entity[] { toParty };

    email["subject"] = [existing email's "subject"]
    email["description"] = [existing email's "description"]
    email["regardingobjectid"] = new EntityReference("opportunity", opportunityId); [EntityReference of opportunity]

    Regards,

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 220 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

#3
Sahra Profile Picture

Sahra 43

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans