Skip to content

Setting Up Finnish Reference Number

In Finland, the Finnish Reference Number is a means to facilitate transactions between suppliers, customers and banks. For domestic payments, companies identify invoices using unique reference numbers. Customers include the numbers on their payments, which are then directed to the companies' bank accounts dedicated to this purpose. For details, see Forming a Finnish Reference Number | Finance Finland.

Reference Number Concepts

Generating the reference numbers involves

  • Creating the reference number
  • Determining the check digit
  • Segmenting the created reference number

To do so, JustOn makes use of Salesforce custom fields on the Invoice object. The final output, that is, the reference number including the check digit, is written to a form field, too.

The following example illustrates the algorithm used to calculate the check digit.

1   2   3   4   5   6   7   1   2   3   4   5   6   7   8
1   3   7   1   3   7   1   3   7   1   3   7   1   3   7
1   6  21   4  15  42   7   3  14   3  12  35   6  21  56 = 246
                                                          = 250 - 246 = 4

This generates the following output, which can be used as a valid Finnish Reference Number:

1 23456 71234 56784

Setting Up Reference Number Fields

Setting up the Finnish Reference Number generation for invoices involves the following tasks:

Once set up as described, JustOn automatically generates valid reference numbers for domestic transactions in Finland, irrespective of whether you send the invoices as PDF or use electronic invoice systems like Basware.

Creating Base Reference Number Field

Companies can freely build their reference numbers around, for example, customer number, invoice number or other identifiers. JustOn uses the Auto number function to generate a unique base number for each invoice.

To hold the base reference number, you must add a corresponding auto number field to the Invoice object.

  1. Navigate to the fields list of the Invoice object.
  2. Create the following new field.
    For help about creating fields, see Managing Object Fields.
Field Name Data Type Starting Number Generate Auto Number Description
FinBankRefSrcNumber Auto Number 1000 Auto-generated number to be used as the Finnish Reference Number and as the base for calculating the check digit.

Creating Check Digit Field

The last digit of the Finnish Reference Number is a check digit, which is calculated based on the base number (see Reference Number Concepts).

In order to hold the check digit, you must add a corresponding formula field to the Invoice object.

  1. Navigate to the fields list of the Invoice object.
  2. Create the following new field.
    For help about creating fields, see Managing Object Fields.
Field Name Data Type Formula Return Type Decimal Places Description
FinBankCheckNumber Formula Number 0 Formula that calculates the check digit to be added to the base number to produce the final Finnish Reference Number.
MOD(
    10 - MOD(
        (
            MOD(VALUE(FinBankRefSrcNumber__c),10) * 7 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),100) - MOD(VALUE(FinBankRefSrcNumber__c),10)) / 10) * 3 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),1000) - MOD(VALUE(FinBankRefSrcNumber__c),100)) / 100) * 1 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),10000) - MOD(VALUE(FinBankRefSrcNumber__c),1000)) / 1000) * 7 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),100000) - MOD(VALUE(FinBankRefSrcNumber__c),10000)) / 10000) * 3 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),1000000) - MOD(VALUE(FinBankRefSrcNumber__c),100000)) / 100000) * 1 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),10000000) - MOD(VALUE(FinBankRefSrcNumber__c),1000000)) / 1000000) * 7 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),100000000) - MOD(VALUE(FinBankRefSrcNumber__c),10000000)) / 10000000) * 3 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),1000000000) - MOD(VALUE(FinBankRefSrcNumber__c),100000000)) / 100000000) * 1 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),10000000000) - MOD(VALUE(FinBankRefSrcNumber__c),1000000000)) / 1000000000) * 7 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),100000000000) - MOD(VALUE(FinBankRefSrcNumber__c),10000000000)) / 10000000000) * 3 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),1000000000000) - MOD(VALUE(FinBankRefSrcNumber__c),100000000000)) / 100000000000) * 1 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),10000000000000) - MOD(VALUE(FinBankRefSrcNumber__c),1000000000000)) / 1000000000000) * 7 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),100000000000000) - MOD(VALUE(FinBankRefSrcNumber__c),10000000000000)) / 10000000000000) * 3 +
            ((MOD(VALUE(FinBankRefSrcNumber__c),1000000000000000) - MOD(VALUE(FinBankRefSrcNumber__c),100000000000000)) / 100000000000000) * 1
        ),
        10
    ),
   10
)

Creating Segmentation Field

The Finnish Reference Number is structured in groups of five digits.

In order to hold the reference number segmentation, you must add a corresponding formula field to the Invoice object.

  1. Navigate to the fields list of the Invoice object.
  2. Create the following new field.
    For help about creating fields, see Managing Object Fields.
Field Name Data Type Formula Return Type Description
FinBankSegNumber Formula Text The segmented reference number without the check digit.
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 15)) = 15,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 15), 1),
    ""
)&
" "&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 14)) = 14,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 14), 5),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 14)) = 13,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 14), 4),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 14)) = 12,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 14), 3),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 14)) = 11,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 14), 2),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 14)) = 10,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 14), 1),
    ""
)&
" "&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 9)) = 9,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 9), 5),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 9)) = 8,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 9), 4),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 9)) = 7,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 9), 3),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 9)) = 6,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 9), 2),
    ""
)&
IF(
    LEN(RIGHT(FinBankRefSrcNumber__c, 9)) = 5,
    LEFT(RIGHT(FinBankRefSrcNumber__c, 9), 1),
    ""
)&
" "&
RIGHT(FinBankRefSrcNumber__c, 4)

Creating Final Output Field

The invoice, finally, must include the complete reference number - segmented into groups of five digits and including the check digit. This number is used as the payment reference for the customer, irrespective of whether you send the invoices as PDF or use electronic invoice systems like Basware.

In order to hold the final output, you must add a corresponding formula field to the Invoice object.

  1. Navigate to the fields list of the Invoice object.
  2. Create the following new field.
    For help about creating fields, see Managing Object Fields.
Field Name Data Type Formula Return Type Description
FinBankNumber Formula Text The (final) Finnish Reference Number.
FinBankSegNumber__c&TEXT(FinBankCheckNumber__c)