엔터티 레코드를 업데이트합니다.
Syntax
microsoft-ciframework.updateRecord(entityLogicalName, id, data).then(successCallback, errorCallback);
매개 변수
| 이름 | 유형 | 필수 | Description |
|---|---|---|---|
| 엔티티논리 이름 | String | Yes | 업데이트하려는 레코드의 엔터티 논리 이름입니다. 예: "계정". |
| 아이디 | String | Yes | 업데이트하려는 엔터티 레코드의 GUID입니다. |
| 데이터 | String | Yes | 쌍을 포함하는 이 항목의 뒷부분에 있는 예제를 참조하여 업데이트 시나리오에 대한 문자열을 |
| success콜백 | 기능 | 아니오 | 레코드가 업데이트될 때 호출하는 함수입니다. |
| error콜백 | 기능 | 아니오 | 작업이 실패할 때 호출하는 함수입니다. |
반환 값
성공하면 업데이트된 속성과 해당 값이 있는 문자열이 포함된 promise를 반환합니다.
예시
이 샘플 코드는 레코드 ID = a8a19cdd-88df-e311-b8e5-6c3be5a8b200인 기존 고객 응대 레코드를 업데이트합니다.
//// define the data to update a record
var entityLogicalName = "contact";
var data = {
"firstname": "Updated Sample",
"lastname": "Contact",
"fullname": "Updated Sample Contact",
"emailaddress1": "contact@contoso.com",
"jobtitle": "Sr. Marketing Manager",
"telephone1": "555-0109",
"description": "Updated values for this record were set programmatically."
}
// update contact record
var id = "b44d31ac-5fd1-e811-8158-000d3af97055";
var jsonData = JSON.stringify(data);
Microsoft.CIFramework.updateRecord(entityLogicalName,id,jsonData).then(
function success (result) {
res=JSON.parse(result);
console.log("Contact updated with ID: " + res.id);
//the record is updated
},
function (error) {
console.log(error);
//handle error conditions
}
);