ftos.data.getById
IMPORTANT!
Starting with v24.3.0, this is renamed from getById to ftos.data.getById.
Starting with v24.3.0, this is renamed from getById to ftos.data.getById.
Returns a record's data based on its ID and parent entity.
This is a data service method for business service components.
Syntax
function ftos.data.getById(entityName: string, id: string): any
| Parameter | Description |
|---|---|
entityName
|
The parent entity, such as entity, attribute, relationship, systemuser, systemusertype, customizationset, businessunit, or portal. |
id
|
Unique internal identifier or the record. |
Return Value
Returns a JSON object that contains key – value pairs of the record's attributes.
Examples
In this example:
- We get information about a relationship with the 116839c6-a372-40e5-baef-00d7a4714349 ID.
- We store the result in an object called record.
var record = ftos.data.getById('relationship', '116839c6-a372-40e5-baef-00d7a4714349');
In this example:
- We get information about a record in the Customers entity with the 061ddd8a-3d8d-4288-8d37-f6d98c689b76 ID.
- We store the result in an object called record.
- We display the Name attribute of the record in a notification message. For more details on how to display notification messages, see ftos.context.response.setMessage.
var record = ftos.data.getById('Customers', '061ddd8a-3d8d-4288-8d37-f6d98c689b76');
ftos.context.response.setMessage(record['Name'], true);