Announcements
No record found.
Hi Guys
I need some help about this error everytime i created new email
can anyone help me on how to fix this?
Thank you so much for the help
*This post is locked for comments
Hi KaeL
You could be getting the above error for couple of reasons and it would be easy if I could have a look at the plugin code that fails but following could possibly be why you are getting the error.
The error you are getting is from the plugin that triggers on Pre-Create of email.
In the plugin code, it seems to be expecting an value in a dictionary possibly looking for an attribute in the entity image (context.InputParameters["Target"]).
Normally, when a record is retrieved, if a field does not have a value, the field wont be int he collection and it could be whey its complaining about the key not being present int he dictionary.
If you have access to code, you could check the plugin code to see what dictionary and value its trying to access.
Hope it helps.
This exception is thrown when you try to index to something that isn't there. For example, you try to use field from the Target entity which are not presents. Or it could be an error when you'are trying to set a value of an entity's field who doesnt exist.
As said in the previous comment, try to send your code and I will be able to make a review about it.
While waiting for your reply, I just want to tell you that you have to use the entity.Contains("FIELD_NAME") before trying to get or set him!
Hi KaeL,
A problem with EmailCreatePre causes an exception. If you post your code, we will be able to pinpoint the issue.
private static void CreateEmail()
{
Uri organizationUri = new Uri("crm/.../Organization.svc");
IServiceConfiguration<IOrganizationService> organizationConfigInfo = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organizationUri);
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential.Domain = "CRM";
credentials.Windows.ClientCredential.UserName = "Administrator";
credentials.Windows.ClientCredential.Password = "Password123";
using (OrganizationServiceProxy proxy = new OrganizationServiceProxy(organizationConfigInfo, credentials))
proxy.EnableProxyTypes();
Email email = new Email
Subject = "Test Email Subject",
ActivityId = Guid.NewGuid()
};
emailID = proxy.Create(email);
Console.WriteLine("email created");
}
I want to try first to test this on a console application and i tried the code from this link and my goal is i want to attach the attachment to email i can able to retrieve the attachment from a custom entity that we stored all of the attachment using the annotation entity. but everytime i tried to make a email record i got this error even on the console application and also i tried on the crm.
and i did another custom workflow from here www.oak3.org/.../attach-note-attachments-emails and still i got the same error.
from this link for creating email docs.microsoft.com/.../sample-create-retrieve-update-delete-email-attachment
Hi Kael,
Go yo Setting》Customization 》Customize My System 》 On a popup, left side nav8gatiob, click on Sdk Message Processing steps.
The above will show you all the plugin steps you have in your system. From here you need to identiy the plugin running on create of email...note them down and the disable. Test your vode again, if it works you need to review the disabled plugin code.
Basically the error is not coming from rhe code which creates email but the plugin which teiggers when the email is created...so your code is creating email which is triggere pre create email plugin and that plugin is failing with the error.
《sorry for any typos, i am usimh my phone keypad》
Hope this help.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
ScottDurow 2
GJones 1