How to Set Up Versioning on an Entity

IMPORTANT!
Entity versioning requires the Digital Foundation deployment package. Make sure you have the Digital Foundation deployment package installed on your FintechOS instance before attempting to version an entity. The Digital Foundation deployment package is included in all Fintech System Packs.

1 Configure the versioned entity's attributes

On the entity that you wish to version, add the following attributes:

  • masterAttributeId - lookup attribute that self-references the versioned entity. You need to also change the default relationship name to a custom value.
  • referencedAttributeId - lookup attribute that self-references the versioned entity. You need to also change the default relationship name to a custom value.
  • attributeVersion - Whole Number
  • attributeVersionDate - Date Time
  • isLastVersion - Boolean

2 Configure the versioned entity's data events

On the entity that you wish to version, create the following event-driven server side scripts:

Name Event Stage Code
<VersionedEntity>_After_Insert Insert After
Copy
var vh=importLibrary("FTOS.VersioningHelper");
context = vh.VersioningHelper.RunAfterInsert(context);
<VersionedEntity>_After_Update Update After
Copy
var vh=importLibrary("FTOS.VersioningHelper");
context = vh.VersioningHelper.RunAfterUpdate(context);
<VersionedEntity>_Before_Insert Insert Before
Copy
var vh=importLibrary("FTOS.VersioningHelper");
context = vh.VersioningHelper.RunBeforeInsert(context);

3 Set Up the Versioning Button

On the form or step where you wish to be able to trigger the record versioning, add the following code in the After Events tab of the Advanced section:

Copy
var vh = ebs.importClientScript("FTOS_VersioningHelper");
vh.createVersioningContext(formScope);
 

This will display the versioning button, which allows you to create a new version of the currently displayed record.

4 Set Up the Entity Workflow

Assign a business workflow to the versioned entity. You may use any workflow that has at least 4 states which you can map to the Draft, Approved, Version Draft, and Version Closed statuses.

HINT
FTOS_VersioningWorkflow is an example of a preset business workflow that meets the above criteria.

5 Configure the Version Settings

  1. Go to Main Menu > Admin > Entity VersioningVersion Settings.
  2. Click the Insert button at the top right corner of the page to create a new set of version settings.
  3. In the Add Version Settings window, enter the following information:
    • Versioned Entity - Name of the entity you are versioning.
    • Status Draft - State in the entity's business workflow you wish to map to the Draft status.
    • Status Approved - State in the entity's business workflow you wish to map to the Approved status.
    • Status Version Draft - State in the entity's business workflow you wish to map to the Version Draft status.
    • Status Version Closed - State in the entity's business workflow you wish to map to the Version Closed status.
    • Name - Assign a name to the set of version settings.

  4. Click the Save and Reload button at the top right corner of the page.

6 Configure the Entity Status Settings

Go to Main Menu > Admin > Entity VersioningEntity Status Settings and insert settings for each of the Draft, Approved, Version Draft, and Version Closed business states of the versioned entity:

  • Entity - Name of the versioned entity.
  • Is Versionable - Indicates if you can trigger the versioning when a record is in this status (typically, it's the Approved status).
  • Status - State in the versioned entity's business flow you mapped to either the Draft, Approved, Version Draft, and Version Closed statuses.
  • Is Listed - Label you can use for customization purposes. Doesn't impact entity behavior.
  • Is Editable - Indicates if you can edit the record when it is in the current status. For instance, you may want to be able to edit a record that is in Draft or Version Draft status, but avoid editing a record that has been archived (is in the Version Closed status).
  • Is Usable - Label you can use for customization purposes. Doesn't impact entity behavior.
  • Is Duplicable - Label you can use for customization purposes. Doesn't impact entity behavior.
  • Name - Assign a name to the entity status settings.