Get PartyList lookup field in Email/Activities entity update partyid record
Get the partylist lookup value and check the lookup value is contact and update the contact
Entity fromActivityParty = targetEntity.GetAttributeValue<EntityCollection>("from").Entities
.Where(x => x.GetAttributeValue<EntityReference>("partyid")?.LogicalName == "contact")
.FirstOrDefault();
if (fromActivityParty == null) return;
EntityReference contactReference = fromActivityParty.GetAttributeValue<EntityReference>("partyid");
Entity contact = new Entity("contact", contactReference.Id);
contact["fullname"]= "ApyCRM";
service.Update(contact);
Comments
Post a Comment