I'm working on a plugin written in c# for an online instance of dynamics crm 2016 update 1.
As said in title, i need to retrieve contact information from a "phonecall" entity created filling the "to" field. that's the code that's not working for me
try { XrmServiceContext svcContext = new XrmServiceContext(service); EntityCollection to = entity.GetAttributeValue<EntityCollection>("to"); for (int i = 0; i < to.Entities.Count; i++) { ActivityParty activityParty = to[i].ToEntity<ActivityParty>(); Contact contact = (from c in svcContext.ContactSet where c.Id.Equals(activityParty.ActivityId.Id) select c).FirstOrDefault(); } } catch (Exception ex) { throw new Exception(ex.Message + "\n" + ex.InnerException.Message); }
the problem it's that activityParty.ActivityId.Id returns an Id that doesn't match with any contanct in crm, anyone could give me a suggestion?