Answered by:
Update Email Recipient using OData

Question
-
Hello,
I am using MS CRM 2011 and I am unable to update the Email recipients using OData in JavaScript.
below is a part of my code:
var Email = new Object();
Email.to = Recipients;
UpdateRecord(EmailId, Email, "EmailSet"); //This is the OData function
I am receiving an error that the "to" field is not a valid property name for Email.
Any suggestions?
- Edited by Joe Mouawad Friday, March 14, 2014 7:05 PM
Friday, March 14, 2014 7:05 PM
Answers
-
Hello,
I fixed it using a custom activity in a workflow which runs when an email is created. This workflow reopens the email and updates the recipients to include only Users and Queues.
- Marked as answer by Joe Mouawad Thursday, April 17, 2014 7:09 AM
- Edited by Joe Mouawad Thursday, April 17, 2014 7:13 AM
Thursday, April 17, 2014 7:09 AM
All replies
-
The to object is actually an array of the activity party, not a set of email addresses. Check out this blog post from Powerobjects to see how to populate that field.
http://www.powerobjects.com/blog/2013/02/22/populate-crm-2011-lookup-partylist-field-javascript/
Sunday, March 16, 2014 2:23 PM -
I know that it is an array of the activity party. The suggested link shows how to set the "to" of the Phone Call on the form and not how to update the "to" of the Phone Call record using the OData.
My aim is to update the activity party of an Email or Phone Call with the CRM web services using Odata.
Monday, March 17, 2014 5:57 AM -
Not sure I can help you with the OData 'update', sorry, but I do have a question.
Are you trying to update a 'new' email/phone call activity record that either hasn't been sent yet, or was just received? If so, you may run into the problem I have which is that once the email is either sent or received, it is considered 'closed' and you can't update it unless you re-activate it, make the update, then close it again. I've had to do this in plugins and it's a bit of a pain, but that's how the activities are handled.
Monday, March 17, 2014 11:34 AM -
Thank you for your reply.
I have faced this issue before with the Received Emails and I have been able to do Update for some custom fields and for the "Regarding of the received email" using Async Javascript calls.
Now I am trying to update the Recipient ('to' field) of the Received Email but the returned error indicates that the "to" field is invalid and not that the Activity cannot be updated because it is closed.
Monday, March 17, 2014 12:09 PM -
Understood. Since the 'to' field is actually a kind of lookup, I suspect it's because it's a related activity party record, not the original email, that needs to be updated. I haven't written any updates with OData so I can't help you there, but maybe see if you can run an Odata update to the activity party entity using the original email/phone activity ID as a key??Monday, March 17, 2014 12:31 PM
-
Hello,
I fixed it using a custom activity in a workflow which runs when an email is created. This workflow reopens the email and updates the recipients to include only Users and Queues.
- Marked as answer by Joe Mouawad Thursday, April 17, 2014 7:09 AM
- Edited by Joe Mouawad Thursday, April 17, 2014 7:13 AM
Thursday, April 17, 2014 7:09 AM