ftos.data.version
(FintechOS 24.3.2 or later)
Versions an entity record.
The record's entity must be configured for cloning and versioning. The new version is based on the entity record that is currently in the Approved state. For more details, see the Entity Cloning and Versioning documentation.
This method creates a new record version with the same attributes as the original, except for the primary key and, optionally, the primary attribute (which can include custom suffixes).
The new version is created in the Version Draft state. To be activated, it has to be approved separately.
This is a data service method for business service components.
Syntax
ftos.data.version(recordId : string, versioningSettingName : string, namingConventionInputs? : { [key : string] : string }): string;
| Parameter | Type | Description |
|---|---|---|
recordId
|
string | The ID (primary key) of the record to be versioned (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 new record version.
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.
- Versions 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 versioned record's ID back to the client using the ftos.context.response.setData method via the x variable.
var name_config=ftos.context.data.name_config;
var x=ftos.data.version(ftos.context.id,name_config,{["env"]:"dev",["ver"]:"test"});
ftos.context.response.setData(x);
On the client side, we set up a versioning function bound to the idTextV button which:
- Uses the ebs.callACtionByNameAsync function to call the script_et_versioning endpoint of the above server automation script, providing the cl_test_et_name clone and version settings to be used for versioning via the name_config input parameter.
- Retrieves the versioned record's ID from the server automation script and uses it to navigate to its edit form via the EbsRouter.callRoute method.
$("#idTextV").on("click", function () {
versioning();
});
function versioning() {
ebs.callActionByNameAsync("script_et_versioning", { "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)
})
};