ftos.data.update
Starting with v24.3.0, this is renamed from update to ftos.data.update.
Updates attribute values for a specific record.
If used in a workflow triggered by an update event of the same entity, infinite loops may occur. Consider using
context.ExecutionDepth instead.This is a data service method for business service components.
Syntax
function ftos.data.update(entityName : string, id : string, values : any): IFtosScriptableEbsExecutionContext;
| Parameter | Type | Description |
|---|---|---|
entityName
|
string | Name of the entity where you wish to update a record. |
id
|
string | ID of the record you wish to update. |
values
|
any | Name – value pairs of the record's updated attributes in JSON format. |
Type Aliases
{
additionalValues : any;
beforeValues : { [key : string] : IEbsPluginValue };
clientScript : string;
readonly entityName : string;
executionDepth : number;
readonly executionType : any;
fetch : IFtosFetch;
id? : string;
values : { [key : string] : IEbsPluginValue };
}
The code of the fetch query.
{
distinct : boolean;
entity : IFtosFetchEntity;
orderBy : IFtosFetchOrderBy[];
page : IFtosFetchPage;
where : IFtosFetchExpression;
}
| Property | Type | Description |
|---|---|---|
distinct
|
boolean | Returns only distinct values, ignoring any duplicates. |
entity
|
IFtosFetchEntity | Details about the entity and attributes to be fetched. |
orderBy
|
IFtosFetchOrderBy[] | Orders the result set ascending or descending based on the specified attributes. |
page
|
IFtosFetchPage | Returns only a specific sequence of results from the result set. |
where
|
IFtosFetchExpression | Criteria used to filter the result set. |
Details about the entity and attributes to be fetched.
{
alias : string;
attributeList : IFtosFetchAttribute[];
join : IFtosFetchJoin[];
name : string;
}
| Property | Type | Description |
|---|---|---|
alias
|
string | Gives the entity a temporary name for the duration of the fetch to be used in the fetch code. |
attributeList
|
IFtosFetchAttribute[] | List of attributes to be fetched. |
join
|
IFtosFetchJoin[] | Combines records from multiple entities based on matching attributes. |
name
|
string | Entity name. |
Orders the result set ascending or descending based on the specified attributes.
{
attribute : string;
type : "asc" | "desc";
}
| Property | Type | Description |
|---|---|---|
attribute
|
string | Attribute name. |
type
|
"asc" | "desc" | Orders results either ascending or descending. |
Returns only a specific sequence of results from the result set.
{
returnCount : boolean;
skip : number;
take : number;
}
| Property | Type | Description |
|---|---|---|
returnCount
|
boolean | Include the number of returned records in the result set. |
skip
|
number | Skips the specified number of records from the beginning of the result set. |
take
|
number | Specifies the number of records to return. |
Criteria used to filter the result set.
{
conditionList : IFtosFetchCondition[];
expressionList : IFtosFetchExpression[];
type : "and" | "or";
}
| Property | Type | Description |
|---|---|---|
conditionList
|
IFtosFetchCondition[] | Filters the returned results based on the specified criterion. |
expressionList
|
IFtosFetchExpression[] | Sub-expression to be used as filtering criterion in the expression. |
type
|
"and" | "or" |
|
Attribute whose values will be returned in the result set.
{
alias : string;
name : string;
}
| Property | Type | Description |
|---|---|---|
alias
|
string | Gives the attribute a temporary name for the duration of the fetch to be used in the fetch code. |
name
|
string | Attribute name. |
Combines records from multiple entities based on matching attributes.
{
entity : IFtosFetchEntity;
fromTo : IFtosFromTo[];
type : "inner" | "left";
}
| Property | Type | Description |
|---|---|---|
entity
|
IFtosFetchEntity | Entity on the right side of the join. |
fromTo
|
IFtosFromTo[] | Pairs attribute values to be matched on the left side and right side of the join. |
type
|
"inner" | "left" |
|
Filters the returned results based on the specified criterion.
{
first : string;
second : string;
type :
"contains" |
"notcontains" |
"equals" |
"notequals" |
"gt" |
"gte" |
"lt" |
"lte" |
"isnotnull" |
"isnull" |
"lastxdays" |
"lastxmonths" |
"lastxyears" |
"nextxdays" |
"nextxmonths" |
"nextxyears" |
"lastxweeks" |
"nextxweeks";
}
| Property | Type | Description |
|---|---|---|
first
|
string | First operator of the condition. |
second
|
string | Second operator of the condition. |
type
|
"contains" | "notcontains" | "equals" | "notequals" | "gt" | "gte" | "lt" | "lte" | "isnotnull" | "isnull" | "lastxdays" | "lastxmonths" | "lastxyears" | "nextxdays" | "nextxmonths" | "nextxyears" | "lastxweeks" | "nextxweeks" | Condition operand. |
Pairs attribute values to be matched in an entity join.
{
from : string;
to : string;
}
| Property | Type | Description |
|---|---|---|
from
|
string | Attribute on the left side of the join. |
to
|
string | Attribute on the right side of the join. |
Return Value
Returns a IFtosScriptableEbsExecutionContext JSON object containing key – value pairs that describe the transaction.
Examples
In this example:
- We update record 6635e79e-037f-4912-899b-1c04c029f27d in the account entity.
- The Name attribute is updated to John.
- The Surname attribute is updated to Ross.
ftos.data.update('account', '6635e79e-037f-4912-899b-1c04c029f27d', { Name: 'John', Surname: 'Ross' });