ftos.data.clone
(FintechOS 24.3.2 or later)
Clones an entity record.
IMPORTANT!
The record's entity must be configured for cloning and versioning. For more details, see the Entity Cloning and Versioning documentation.
The record's entity must be configured for cloning and versioning. For more details, see the Entity Cloning and Versioning documentation.
This method creates a new record with the same attributes as the original, except for the primary key and, optionally, the primary attribute (which can include custom suffixes).
This is a data service method for business service components.
Syntax
Copy
ftos.data.clone(recordId : string, versioningSettingName : string, namingConventionInputs? : { [key : string] : string }): string;
| Parameter | Type | Description |
|---|---|---|
recordId
|
string | The ID (primary key) of the record to be cloned (GUID). |
versioningSettingName
|
string | The name of the clone and version settings to use. |
NamingConventionInputs (optional) |
{ [key: string]: string } |
Dictionary of suffix key-value pair(s) to be appended to the primary key:
|
Return Value
Returns the ID of the newly cloned record.
Examples
In this example, we create a server automation script that:
- Uses the data property of the ftos.context object to retrieve the name_config input parameter from the client process. This parameter stores the name of the entity's clone and version settings that will be used for cloning.
- Clones the current record using the id property of the ftos.context object to input the record ID, the name_config variable for the entity's clone and version settings, and applies the dev and test suffixes for the env and ver naming suffix keys repectively.
- Sends the clone's record ID back to the client using the ftos.context.response.setData method via the x variable.
Copy
var name_config=ftos.context.data.name_config;
var x=ftos.data.clone(ftos.context.id,name_config,{["env"]:"dev",["ver"]:"test"});
ftos.context.response.setData(x);
On the client side, we set up a cloning function bound to the idTextC button which:
- Uses the ebs.callACtionByNameAsync function to call the script_et_cloning endpoint of the above server automation script, providing the cl_test_et_name clone and version settings to be used for cloning via the name_config input parameter.
- Retrieves the cloned record ID from the server automation script and uses it to navigate to its edit form via the EbsRouter.callRoute method.
Copy
$("#idTextC").on("click", function () {
cloning();
});
function cloning() {
ebs.callActionByNameAsync("script_et_cloning", { "name_config": "cl_test_et_name"})
.then(function (e) {
var myState = {
routeData: {
entityName: EbsRouter.getState().routeData.entityName,
formId: e.UIResult.Data,
formName: "test_et_name_vc",
pageNo: "0",
type: "edit"
}
};
EbsRouter.callRoute('#/userjourney', myState)
})
};