public Entity RetrieveLookupByAttribute(string attrName, object attrValue) { ThrowIf.Argument.IsNullOrEmpty(attrName, "attrName"); var targetEntity = this.LookupTargetEntityName; if (string.IsNullOrEmpty(targetEntity)) { throw new InvalidPluginExecutionException("Field mapping error, lookup target entity is empty."); } var targets = OrgService.RetrieveMultipleByAttribute(targetEntity, attrName, attrValue); return(targets.FirstOrDefault()); }