Hi community,
I'm having issues with sending e-mails from within my plugin, I'm consistently getting an error stating that 'partyobjecttypecode' is NULL:
// incident is the Entity that was changed [LogicalName = incident]
// service is the IOrganizationService
// kuc_primarycontactid is a mandatory Reference to the Entity contact.
Entity email = new Entity("email"); // create new mail email["subject"] = strSubject; email["description"] = strBody; EntityCollection to = new EntityCollection(); EntityReference contact = incident.GetAttributeValue<EntityReference>("kuc_primarycontactid"); // contact Entity party = new Entity("activityparty"); party["partyid"] = contact; to.Entities.Add(party); email["to"] = to; service.Create(email);
--> <Message>Attribute 'partyobjecttypecode' cannot be NULL</Message>
How do I get rid of this error?
*This post is locked for comments
Nevermind. I reduced my actual code to this, and now it's working - so my more complex code clearly has some issues that I have to deal with and they're the reason for this issue.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156