엔터티 레코드를 검색합니다.
Syntax
Microsoft.CIFramework.retrieveRecord(entityLogicalName, id, options).then(successCallback, errorCallback);
매개 변수
| 이름 | 유형 | 필수 | Description |
|---|---|---|---|
| 엔티티논리 이름 | String | Yes | 검색하려는 레코드의 엔터티 논리 이름입니다. 예: "계정". |
| 아이디 | String | Yes | 검색하려는 엔터티 레코드의 GUID입니다. |
| options | String | 아니오 | OData 시스템 쿼리 옵션인 $select 및 $expand를 사용하여 데이터를 검색할 수 있습니다.
로 시작하는 ?$select=name&$expand=primarycontactid($select=contactid,fullname)
|
| success콜백 | 기능 | 아니오 | 레코드를 검색할 때 호출하는 함수입니다. |
| error콜백 | 기능 | 아니오 | 작업이 실패할 때 호출하는 함수입니다. |
반환 값
성공하면 검색된 속성과 해당 값이 있는 문자열이 포함된 promise를 반환합니다.
예시
이 샘플 코드는 ID = a8a19cdd-88df-e311-b8e5-6c3be5a8b200를 가진 연락처 레코드의 이름과 전화번호를 검색합니다.
// retrieve contact record
var id = "b44d31ac-5fd1-e811-8158-000d3af97055";
var entityLogicalName = "contact";
Microsoft.CIFramework.retrieveRecord(entityLogicalName, id, "?$select=fullname,telephone1").then(
function success(result) {
res=JSON.parse(result);
console.log(`Retrieved values: Full Name: ${res.fullname}, Telephone Number: ${res.telephone1}`);
// perform operations on record retrieval
},
function (error) {
console.log(error.message);
// handle error conditions
}
);