2012-12-05 4 views
0

엔티티에있는 모든 속성의 속성 유형을 반환하는 CRM 기능이 있습니다. 이 동일한 메서드가 과거에 작동 했음에도 불구하고 내 문제는 모두 그것이 전달하는 엔터티에 관계없이이 오류를 던지고 있습니다. , 나는 "계정"개체를 전달 해요 매개 변수를 다음 http://schemas.microsoft.com/xrm/2011/Contracts/Services:ExecuteResult매개 변수를 deserialize하는 동안 CRM 오류가 발생했습니다.

내 코드가 직렬화하는 동안

오류가 발생했습니다.

public string GetFieldType(IOrganizationService svc, string entity, string fieldName) 
     { 
      RetrieveEntityRequest request = new RetrieveEntityRequest() 
      { 
       EntityFilters = EntityFilters.Attributes, 
       LogicalName = entity 
      }; 

      RetrieveEntityResponse response = (RetrieveEntityResponse)svc.Execute(request); 
      string type = ""; 
      foreach (AttributeMetadata attribute in response.EntityMetadata.Attributes) 
      { 
       if (attribute.LogicalName == fieldName) 
       { type = attribute.AttributeType.ToString(); } 
      } 

      return type; 
     } 
+1

초기 바인딩 된 엔터티를 사용하고 있습니까? –

답변

0

코드가 이전에 작동 중이었지만 지금은 그렇지 않은 경우 코드에 문제가없는 것입니다. 대부분 svc.Execute이 실패 할 가능성이 큽니다. IOrganizationService의 생성 방법을 변경 했습니까? CRM 인스턴스를 쿼리 할 권한이있는 사용자로 실행하고 있습니까? 이 모든 것들이 체크 아웃되면 diagnostic tool을 통해 서버 측 추적을 켜보십시오.

관련 문제