Asked by:
Code for creating Email record using Plugin

Question
-
Can I get the Plugin Code for create the email record along with From,To,CC,Subject,Body & Attachments ?
I need to populate the existing values of From,To,CC,Subject,Body & Attachments fields. I need to create this in PreCreate Operation.
Pls help me out.
Monday, March 21, 2016 7:01 AM
All replies
-
Hi,
What data do you want to populate the fields with?
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seMonday, March 21, 2016 7:44 AM -
While creating a new email activity I need to create the email record along with From,To,CC,Subject,Body & Attachments fieldsMonday, March 21, 2016 7:54 AM
-
Hello Santhosh,
Sorry for obvious question. Have you tried to use search engine? I believe you have not because I found a lot of sample code. So let me bing that for you.
PS Try to use Search Engines one day - it is freaking awesome!
Dynamics CRM MVP
Read My blog
Subscribe for one of my coursesMonday, March 21, 2016 9:34 AMModerator -
On Create of email record, check whether an flag attribute exist. if it exists then clone email records that means from, to cc parties and subject, body attachments should be populated in new email recordMonday, March 21, 2016 9:53 AM -
Hello,
Fairly it is unprofessional to post parts of your development specification asking for a help. I already provided you samples that answer your question so try to do something with own hands.
Dynamics CRM MVP
Read My blog
Subscribe for one of my coursesMonday, March 21, 2016 9:56 AMModerator -
I'm sorry, but I don't quite understand what you are trying to do. Do you want to create a copy of the email that you're creating?
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seMonday, March 21, 2016 11:23 AM -
Obviously.Thats wat am looking for...Tuesday, March 22, 2016 5:49 AM
-
Hi,
Well, in that case
Entity emailCopy = new Entity(target.LogicalName); emailCopy.Attributes.Add("to", target["to"]);
(it's probably some sort of casing error above, did that from the top of my head)
Do that for all the attributes you want to have on the copy and then use service.Create(emailCopy). Now, you also want to have a check for depth for this since you only want one copy. This could also be done with a workflow btw, unsure how you get rid of the recursion there though, maybe set a flag saying "this is a copy" or something. Still I don't really understand the need but that's not a forum discussion I think.
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seTuesday, March 22, 2016 7:28 AM -
Hi,
Thank you for your response.
need : I need to write a plugin on create of email record. I need to check whether the flag attribute exists. If it exists I need to clone From,To,Subject and CC fields as new email record.
Tuesday, March 22, 2016 7:52 AM -
Hi,
What is the flag attribute in this case? Should you send the new email so the recipients get two emails?
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seTuesday, March 22, 2016 7:58 AM -
I created a flag attribute in my solution,based on this I need to clone the values.Tuesday, March 22, 2016 9:42 AM
-
How to create a new email record using the GUID of Existing Email record ?
- Merged by Andrii ButenkoMVP, Moderator Monday, March 28, 2016 9:29 AM The same thread
Monday, March 28, 2016 9:09 AM -
How to create a new email record using the GUID of Existing Email record ?
No duplicated threads, please.Dynamics CRM MVP
Read My blog
Subscribe for one of my coursesMonday, March 28, 2016 9:30 AMModerator -
Hi,
Did Andrii solve this problem in the other thread?
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seTuesday, March 29, 2016 1:40 PM -
I believe that not yet and I believe that this will take some time.
Dynamics CRM MVP
Read My blog
Subscribe for one of my coursesTuesday, March 29, 2016 4:48 PMModerator