Skip to content

Setting Up KID Generation

The KID (kundeidentifikasjon) is a customer identification number that is mandatory for invoices in Norway. The KID provides a payment reference to the vendor and ensures that the vendor is posting the payment correctly. For more information, see KID-nummer.

You can set up JustOn to generate KID numbers on account basis and document basis (invoice or statement).

Info

The KID generation is available as of JustOn 2.46.

Once set up, JustOn creates a new KID number when the defined conditions are met. The numbers are created in ascending order. Note that the last digit is a MOD-10 checksum, so that two consecutive numbers are no neighboring natural numbers.

The KID number can be referred to from an invoice template (v1) using the custom placeholders [KIDCustomer] (account-based KID) and [KIDDocument] (invoice or dunning-based KID). These placeholders are intended to be used in the Payment Reference field, but you can include them in other template fields as necessary.

Setting Up Account-Based KID Generation

Setting up the KID generation on account basis involves the following tasks:

Creating Custom Field for KID

In order to hold the KID number, you must add a corresponding field to the Account object.

  1. Navigate to the fields list of the Account object.
  2. Create the following new field.

    Field Label API Name Data Type
    KID Customer ON_KID_Customer__c Text (255)

    For help about creating fields, see Managing Object Fields.

Info

When sending electronic invoices via Basware, the produced number must also be propagated to the custom Invoice field BaswarePaymentIdentifierId__c. Basware includes this information in the field paymentIdentifier.id of its paymentMeans object, and produces an error if it is missing.

Creating KID Counter

As a basis for the KID number, you must create a specific counter.

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of Counters, then click New.

  3. Specify the details as follows, then click Save.

    Field Possible Values Description
    Name KID_Customer The name must be set to KID_Customer to enable the KID generation for an account.
    Reset empty A counter reset on a yearly or monthly basis is not applicable.
    Template {00000000}
    999999{000000000000000000}
    The template must consist of digits only. You can define up to 18 variable digits, which may be prefixed with up to 6 fixed digits. The overall length must not exceed 24 digits.
    Use Account Counters unselected This parameter is not applicable.

Creating KID Generation Process

To trigger the KID generation, you must create a process that calls the appropriate Apex class provided by JustOn.

Note

Depending on your use cases, the process setup will vary.

  1. In Setup, open Process Builder.

    In Salesforce Lightning, navigate to Process Automation > Process Builder.

    In Salesforce Classic, navigate to Create > Workflow & Approvals > Process Builder.

  2. Click New.

  3. Specify a (descriptive) process name.
  4. Set the process to start when A record changes.
  5. Configure the process as required.

    Step Option Description
    Add Object Object The object whose modifications are to trigger the KID creation, must be Account
    Start the process The type of record change that triggers the process, must be when a record is created or edited
    Add Criteria Criteria for Executing Actions The type of criteria, determines whether to check for specific field values or to evaluate records using a formula
    Set Conditions | Build Formula The use case-specific criteria, either the filter conditions for evaluating field values or the formula
    Add Action Action Type The type of action to be executed, must be Apex
    Apex Class The Apex class to be executed, must be Generate KID on accounts
    Set Apex Variables Invocable variables for the Apex class
    Account Id specifies the reference to the ID field of the account for which to generate the KID
  6. Click Save.

  7. Click Activate.

    When the defined process criteria are met, JustOn creates a new KID number for the account. The KID number can be referred to from an invoice template (v1) using the custom placeholder [KIDCustomer].

    For help about creating processes, see Lightning Process Builder in the Salesforce Help.

Example use case: Create KID when account is activated

You can, for example, trigger the KID creation process when an account is set active.

Option Value
The process starts when A record changes
Object Account
Start the process when a record is created or edited
Criteria for Executing Actions Conditions are met
Set Conditions [Account].Active__c Is changed True
[Account].Active__c Equals Yes
All of the conditions are met
Action Type Apex
Apex Class Generate KID on accounts
Set Apex Variables Account Id Field Reference [Account].Id

This triggers JustOn to execute the process when the Active field of the account is set Yes: It creates a KID for the customer and saves it to the KID field.

Setting Up Document-Based KID Generation

Setting up the KID generation on document basis (invoice or statement) involves the following tasks:

Creating Custom Field for KID

In order to hold the KID number, you must add a corresponding field to the Invoice or Dunning object.

  1. Navigate to the fields list of the Invoice or Dunning object.
  2. Create the following new field.

    Field Label API Name Data Type
    KID Document ON_KID_Document__c Text (255)

    For help about creating fields, see Managing Object Fields.

Info

When sending electronic invoices via Basware, the produced number must also be propagated to the custom Invoice field BaswarePaymentIdentifierId__c. Basware includes this information in the field paymentIdentifier.id of its paymentMeans object, and produces an error if it is missing.

Creating KID Counter

As a basis for the KID number, you must create a specific counter.

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of Counters, then click New.

  3. Specify the details as follows, then click Save.

    Field Possible Values Description
    Name KID_Document The name must be set to KID_Document to enable the KID generation for invoices or dunnings.
    Reset empty A counter reset on a yearly or monthly basis is not applicable.
    Template {00000000}
    999999{000000000000000000}
    The template must consist of digits only. You can define up to 18 variable digits, which may be prefixed with up to 6 fixed digits. The overall length must not exceed 24 digits.
    Use Account Counters unselected This parameter is not applicable.

    When the invoice is finalized or the dunning is closed, JustOn creates a new KID number for the specific record. The KID number can be referred to from an invoice template (v1) using the custom placeholders [KIDDocument].