Use Sequencer to create the Application Number
A financial institution has a large number of customers. To keep track of all the customers and give each a unique application number which can have a certain structure, FintechOS Studio offers Sequencer. For more details, see Sequencer.
Task at hand
Create a data form to add new customers where the user can gather data about the customer. The application of each customer must have a number unique and the number must be incremented with each customer added.
Before you begin
- Create the entity FTOS_AB_Account with the following attributes:
UniqueID
ApplicationNo (to this number we will use the Sequencer) income PIN
country country applicationAmount creditProposalDate creditProposalDate fullName
consent to GDPR applicationAgency age
currency birthPlace address
applicationTypeId city contractTypeId email
consent to Terms and Conditions - Create a dashboard named AccountDashboard.
- Expose the data form of this entity to the dashboard.
1 Create the Sequencer
Follow the path: FintechOS Studio > Advanced > Sequencer.
The Sequencer list is displayed.
Click the Insert button to open the Add sequencer page.
Fill in the following fields:
Field | Description |
---|---|
Name | Insert applicationNumberLoan. |
Code | Insert a code which will be used in the server-side script. |
Padding | This is the number of characters for a sequence. For example, set the padding nr. 5, the sequence will be 00001. |
RangeMin | Insert the minimum number from which the sequencer to begin. This number will not be incrented the first time it is used, i.e. when the sequencer is called the first time it will use the number here, and for the next application it will increment it. |
RangeMax |
This is the maximum number to which the sequencer can span to. |
Start date |
Select the start date. It can be a date from the past. |
End date |
Select the end date. |
Click the Save and close button.
2 Create the server-side script
Follow the path: FintechOS Studio > Advanced > Server automation scrips.
The Server automation scripts list is displayed. Click the Insert button to add a new script, and open the page General. Fill in the following fields, they configure the moment when the scrip is executed, which is before the
Field | Description |
---|---|
Name | Insert ApplicationSequencer_Number. |
Script type | Select from the list Event triggered. |
Event | Select from the list Insert. |
Stage |
Select from the list Before. |
Entity | Select from the list the entity created earlier, FTOS_AB_Account. |
Insert the following code:
Server automation script
var ApplicationSequencer_Number = getSequenceNumber ('APPNOL');
context.values.ApplicationNo = ApplicationSequencer_Number;
The first line calls the sequencer with its code. The second maps the result to the attribute.
Click the Save and reload button.
2 Test the Sequencer in the FintechOS Portal
Follow the path: FintechOS Portal> Account Dashboard > FTOS_AB_Account data form.
Open the form to add some records and to test the sequencer in action. First, fill in the other fields such as name and age, the click the Save and reload. The ApplicationNo will be populated.
Click the Save and reload button to see the application number be inserted.
Congratulations! You have created the numbering of the application.