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 Flow

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

Note

Depending on your use cases, the flow setup and the objects to involve will vary.

  1. In Setup, navigate to Process Automation > Flows.
  2. Click New Flow.
  3. Select Record-Triggered Flow and click Create.
  4. Configure the Start element.

    Option Description
    Object The object whose record modifications are to update a source record, must be Account
    Trigger The type of record change that triggers the flow
    Conditions The use case-specific trigger conditions, one or more filter criteria for evaluating certain field values or a formula for evaluating records
    Optimize for Actions and Related Records
  5. Click and add the following Action element.

    Option Description
    Action The Apex class to call, must be Generate KID on accounts
    Input Values Invocable variables for the Apex class
    Account Id: specifies the reference to the ID field of the account for which to generate the KID, like {!$Record.Id}

    Specify a label and an API name as required.

  6. Click Save.

    Specify a label and an API name as required.

  7. Click Activate.

    When the defined conditions are met, JustOn triggers the flow and creates a new KID number for the account.

    The KID number can then be referred to from an invoice template (v1) using the custom placeholder [KIDCustomer].

    For help about creating flows, see Flows in the Salesforce Help.

Example use case: Create KID when account is activated

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

To this end, you set up the flow as follows:

Flow Element Option Value
Start Object Account
Trigger A record is updated
Conditions All Conditions Are Met (AND)
1: Active__c Equals Yes
2: Active__c Is changed {!$GlobalConstant.True}
Action Action Generate KID on accounts
Input Values Account Id: {!$Record.Id}

This triggers JustOn to execute the flow 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 then be referred to from an invoice template (v1) using the custom placeholder [KIDCustomer].