Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves an entity record.
Syntax
Microsoft.CIFramework.retrieveRecord(entityLogicalName, id, options).then(successCallback, errorCallback);
Parameters
Name | Type | Required | Description |
---|---|---|---|
entityLogicalName | String | Yes | The entity logical name of the record you want to retrieve. For example: "account". |
id | String | Yes | GUID of the entity record you want to retrieve. |
options | String | No | OData system query options, $select and $expand, to retrieve your data.
You specify the query options starting with ?$select=name&$expand=primarycontactid($select=contactid,fullname)
|
successCallback | Function | No | A function to call when a record is retrieved. |
errorCallback | Function | No | A function to call when the operation fails. |
Return Value
On success, returns a promise containing a string with the retrieved attributes and their values.
Examples
This sample code retrieves the name and phone number of a contact record with 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
}
);