2016-06-06 1 views
1

플러그인을 사용하여 사용자 지정 티켓 번호를 만들었지 만 "고객"필드에서 선택한 사용자를 검색하는 데 문제가 있습니다. OOB "연락처"엔티티를 참조하는 것으로 보이는 OOB "사례"엔티티에서 선택된 값을 얻으려면 어떻게해야합니까? 내 문자열에 "Microsoft.XRM.Sdk.EntityReference"가 반환됩니다. 롤.CRM 2013 - OOB "고객 ID"필드 값 검색

var custName = myEntity.Attributes["customerid"]; <--nope 
var custName = myEntity["customerid"]; <--nope 
var custName = myEntity.GetAttributeValue<string>("customerid"); <--I had high hopes for this, but only get a blank value. :(

도와주세요.

답변

2

customerid 필드는 조회이므로 서버 측에서 사용자가 EntityReference이되는 것이 정상입니다. 올바른 방법은이 방법입니다.

EntityReference customerRef = myEntity.GetAttributeValue<EntityReference>("customerid"); 
string customerName = customerRef.Name; 
+0

이 방법을 시도했지만 빈 값만 나타납니다. OOB Contact 엔티티를 더 살펴 봤는데 복합 필드가 문제의 일부일 수 있다고 생각합니까? 기본값은 "fullname"이지만, 참조하려고 할 때 "..key in dictionary .."오류가 발생합니다. 어떤 아이디어? – snapplex

+0

빈 값을 얻으면 항상 Entity customer = service.Retrieve (customerRef.LogicalName, customerRef.Id, new ColumnSet (true))와 같은 연락처/계정 엔터티를 검색 할 수 있습니다. –

+0

내가 왜 그 모든 농구를 뛰어 넘어야하는지 확신 할 수는 없지만, 그 트릭을했다. 도움을 주셔서 감사합니다. @Guido – snapplex

관련 문제