Sunday, 1 September 2013

Get Entity type Code Mscrm 2011 plugin code







private int GetEntityTypeCode(IOrganizationService service)
        {
            RetrieveEntityRequest request = new RetrieveEntityRequest();
            request.LogicalName = "Entity Name ";
            RetrieveEntityResponse response = (RetrieveEntityResponse)service.Execute(request);
            int objectTypecode = response.EntityMetadata.ObjectTypeCode.Value;
            return objectTypecode;
        }