Model class in Creatio Mobile
The Model class implements a data model to execute operations with data source records. To work with the Model class in web applications, follow the instructions: Model class (developer documentation).
Methods
load()
Retrieves a record from a data source. A configuration object is a key-value collection.
Parameters
attributes
Specifies record columns to retrieve from the data source. The attributes property limits the retrieved data, which, in turn, improves performance and reduces unnecessary data transfer.
parameters
An array of query filters.
Parameters
type | The parameter type. The |
value | The |
To retrieve a dedicated record, set the ModelParameterType.PrimaryColumnValue value to the type parameter and record ID to the value parameter.
const result = await model.load({
attributes: ['Name'],
parameters: [{
type: ModelParameterType.PrimaryColumnValue,
value: 'd4f93b6c-362c-4954-8bd6-1658e9206d4e'
}]
});
loadOptions
Additional properties required to set up pagination, sorting and caching.
Parameters
pagingConfig | Sets up pagination that controls rows of data to retrieve at once. Parameters
| ||||||||||||||||||||||
sortingConfig | Sets up sorting of retrieved data. Parameters
| ||||||||||||||||||||||
cacheOperation | Manages caching of data retrieved from the data source. Parameters
|
insert()
Adds a record to a data source. A configuration object is a key-value collection.
Parameters
cacheOperation
Manages caching of data added to the data source.
Parameters
updateCache | The flag that specifies whether the Available values
|
copy()
Copies the original record from a data source. To add a new record, use the model.insert() method. Specify record ID that identifies a record to copy from the data source and a list of modified values for a new record.
update()
Modifies a record in a data source. A configuration object is a key-value collection.
Parameters
{DataSourceParameters}
An array of parameters that identify a record to modify.
Parameters
type | The parameter type. The |
value | The record ID. |
cacheOperation
Manages caching of data modified in the data source.
Parameters
updateCache | The flag that specifies whether the Available values
|
delete()
Deletes a record from a data source. A configuration object is a key-value collection.
Parameters
{DataSourceParameters}
An array of parameters that identify a record to delete.
Parameters
type | The parameter type. The |
value | The record ID. |
cacheOperation
Manages caching of data deleted from the data source.
Parameters
updateCache | The flag that specifies whether the Available values
|