Hi Guys,
When an email comes into our CRM, the "from" is associated to a contact. That contact is associated to a parentcustumerid.
I need the retrieve that id so i can do a query on a the incident entity and see if a case already exists with same customer and subject.
i figured out how to get read entity reference from the email, but i am not sure how to retrieve its information (i could do a query but i'm sure there is a more efficient way) - i guess i need the guid or the name of the account to query the incident entity.
EntityCollection fromCollection = (EntityCollection)entity["from"]; if (fromCollection != null && fromCollection.Entities.Count > 0) { Entity fromParty = fromCollection[0]; //activityparty entity EntityReference fromRef = (EntityReference)fromParty["partyid"]; ColumnSet attributes = new ColumnSet(new string[] { "new_quicknote", "regardingobjectid", "subject" }); Entity entty = service.Retrieve(entity.LogicalName, entity.Id, attributes); //entty.Attributes["new_quicknote"] = fromRef.name.ToString(); entty.Attributes["regardingobjectid"] = fromRef; service.Update(entty); } context.InputParameters["Target"] = entity;
*This post is locked for comments