CRM 2011 plugin: Getting entity by ID RRS feed

  • Question

  • Hi,

    I have created a plugin on RetrieveMultiple of activitypointer.  The plugin allows a user to see a roll up of activities from custom entities when on the parent entity.  My issue is that I have the id of the record that triggered the plugin, but need either its name or objecttypecode.  My code currently looks like this to get the id;

    QueryExpression res = context.InputParameters["Query"] as QueryExpression; if (res == null) return; if (res.LinkEntities.Count == 0) return; if (res.Criteria.Conditions.Count > 0) return; LinkEntity lnk = res.LinkEntities[0] as LinkEntity; if (lnk.LinkCriteria.Conditions.Count == 0) return; ConditionExpression cond = lnk.LinkCriteria.Conditions[0] as ConditionExpression; if (cond.Values.Count == 0) return;

    Guid callerentityid; if (!Guid.TryParse(cond.Values[0].ToString(), out callerentityid)) return;

    Here I am able to get the id of the entity that has triggered the plugin (by trying to view Activities from that entity). But I need name or objecttypecode.  Well i just really need objecttypecode, but could get that if I had the name.

    Is there any way to do this? As the plugin is registered against activitypointer I am finding this hard.

    Thanks for any pointers anyone can give.

    Wednesday, October 15, 2014 1:57 PM

All replies