Hi
I'm having trouble changing the from field on an incoming email.
The scenario is that if I receive an email from a customer that hasn't got a record in CRM, I want to create a customer and set the from field on the email activity to that customer.
I have a plugin registered on pre-validation that fires, creates the new customer and attempts to set the from field. The from field is an party list field, and I believe there is a problem updating party lists in the pre-validation step (from this http://mscrmuk.blogspot.co.uk/2011/07/partylist-attributes-and-plugin-event.html).
The code I have to create the customer and update the party list is as follows:
// Create a new customer conId = CreateNewCustomer(localContext, entity); // Update the email with the newly created customer Entity fromParty = new Entity("activityparty"); fromParty["partyid"] = new EntityReference("contact", conId); entity["from"] = new EntityCollection( new List<Entity>(){ fromParty } );
I've also tried this in the pre-validation stage but the plugin just doesn't fire.
Any thoughts on how to do this?