다음을 통해 공유


복합 특성에 대한 스크립트 작성

 

게시 날짜: 2017년 1월

적용 대상: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

양식에 추가된 일부 필드는 데이터의 여러 항목을 나타낼 수 있습니다. 이러한 복합 특성은 웹 응용 프로그램에 표시될 때 다른 특성과 다르게 동작하므로 스크립트를 제대로 사용하려면 다르게 작성해야 합니다.

이 항목의 내용

복합 특성

웹 응용 프로그램의 복합 특성

태블릿용 Dynamics 365의 복합 특성

차이점 마이그레이션

복합 특성

다음 표에는 복합 특성이 나와 있습니다.

엔터티

표시 이름

논리적 이름

Contact

전체 이름

fullname

주소 1

address1_composite

주소 2

address2_composite

Lead

전체 이름

fullname

주소 1

address1_composite

주소 2

address2_composite

User

전체 이름

fullname

주소

address1_composite

기타 주소

address2_composite

Account

주소 1

address1_composite

주소 2

address2_composite

Quote

청구지 주소

billto_composite

운송지 주소

shipto_composite

Order

청구지 주소

billto_composite

운송지 주소

shipto_composite

Invoice

청구지 주소

billto_composite

운송지 주소

shipto_composite

웹 응용 프로그램의 복합 특성

복합 특성의 필드를 기본 양식에 추가하면 웹 응용 프로그램에서 복합 특성을 표시합니다. 다른 사람이 필드를 편집하면 복합 특성을 구성하는 개별 특성을 표시하는 플라이아웃이 표시됩니다. 양식 편집기에서 양식에 명시적으로 추가되지 않아도 특성에 포함된 각 특성은 양식에 사용할 수 있습니다.getValue를 사용하여 복합 값의 값을 읽을 수 있지만 setValue를 사용하여 복합 특성의 값을 직접 변경할 수 없으므로 복합 특성에서 참조하는 특성을 하나 이상 설정해야 합니다.

플라이아웃에 이름별로 표시된 개별 구성원 컨트롤에 액세스할 수 있습니다. 이러한 컨트롤은 <composite control name>_compositionLinkControl_<constituent attribute name> 명명 규칙을 사용합니다.address1_composite 컨트롤에서 address_line1 컨트롤에 액세스하려면 Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_line1")을 사용합니다.

태블릿용 Dynamics 365의 복합 특성

태블릿용 Microsoft Dynamics 365은 복합 특성을 가진 엔터티에 사용되는 동일한 양식 정의를 사용하지만 다르게 해석합니다. 복합 특성이 양식 정의에 있을 경우 복합 특성에 포함된 모든 특성이 해당 양식 섹션에 표시됩니다. 모든 필드가 표시되므로 플라이아웃이 필요하지 않습니다. 양식에 개별적으로 추가한 것처럼 각 개별 특성에 액세스하는 양식에 대한 스크립트를 작성할 수 있습니다.

하지만 실제 복합 컨트롤은 태블릿용 Dynamics 365 페이지에 표시되지 않습니다.

차이점 마이그레이션

Contact, Lead 또는 User 엔터티에 대한 fullname 필드에 액세스하려는 경우 **Xrm.Page.data.entity.**fbaf2e7a-db2f-448f-bd24-6b3ca1ccb28e#BKMK_getPrimaryAttributeValue 메서드를 사용하면 직접 참조하지 않고 이 특성의 값을 쉽게 가져올 수 있습니다. 이 방법은 웹 응용 프로그램 및 태블릿용 Dynamics 365 양쪽에 작동합니다.

주소 복합 특성 중 하나의 값을 읽어야 코드가 있을 경우 양쪽 클라이언트에서 사용하려면 기본 웹 응용 프로그램 또는 동일한 양식의 태블릿용 Dynamics 365 버전에서 **Xrm.Utility.**72a66f93-92df-42b9-a8fd-b6125c7fe83b#BKMK_alertDialog를 사용하여 형식이 있는 주소를 표시하는 다음 함수에서 표시하는 것처럼 Xrm.Page.context.client.getClient를 사용하여 코드를 분리해야 합니다.

function showAddressDialog() {
 var address1_compositeValue;
 if (Xrm.Page.context.client.getClient() != "Mobile") {
  address1_compositeValue = Xrm.Page.getAttribute("address1_composite").getValue();
 }
 else {
  var address1_line1 = Xrm.Page.getAttribute("address1_line1").getValue();
  var address1_line2 = Xrm.Page.getAttribute("address1_line2").getValue();
  var address1_line3 = Xrm.Page.getAttribute("address1_line3").getValue();
  var address1_city = Xrm.Page.getAttribute("address1_city").getValue();
  var address1_stateorprovince = Xrm.Page.getAttribute("address1_stateorprovince").getValue();
  var address1_postalcode = Xrm.Page.getAttribute("address1_postalcode").getValue();
  var address1_country = Xrm.Page.getAttribute("address1_country").getValue();

  // Achieve equivalent formatting
  //address1_line1
  //address1_line2
  //address1_line3
  //address1_city, address1_stateorprovince address1_postalcode
  //address1_country

  var addressText = "";
  if (address1_line1 != null) {
   addressText += address1_line1 + "\n";
  }
  if (address1_line2 != null) {
   addressText += address1_line2 + "\n";
  }
  if (address1_line3 != null) {
   addressText += address1_line3 + "\n";
  }
  if (address1_city != null) {
   addressText += address1_city + ", ";
  }
  if (address1_stateorprovince != null) {
   addressText += address1_stateorprovince + " ";
  }
  if (address1_postalcode != null) {
   addressText += address1_postalcode + "\n";
  }
  addressText += address1_country;

  address1_compositeValue = addressText;
 }
 Xrm.Utility.alertDialog(address1_compositeValue);
}

참고 항목

Microsoft Dynamics 365 양식용 코드 작성
양식 및 필드 이벤트 사용
Xrm.Page 개체 모델 사용
휴대폰 및 태블릿용 Dynamics 365에 대한 스크립트 작성 및 디버깅
실행 컨텍스트 및 양식 이벤트 파이프라인 사용
양식에서 IFRAME 및 웹 리소스 컨트롤 사용
양식 스크립팅 빠른 참조
클라이언트 쪽 프로그래밍 참조
Xrm.Page.data.entity 특성(클라이언트 쪽 참조)

Microsoft Dynamics 365

© 2017 Microsoft. All rights reserved. 저작권 정보