Dunning: fields

Prev Next

After some problems with outstanding payments, José asks Linda to automate the sent out of dunning emails. He specifies that he wants the dunning emails to be sent automatically, at the right date and time, to the right people, and about the right invoices according to the defined business needs (exceptions, frequency, etc.).

A bit overwhelmed by this demand, Linda asks Vijay again to help her with this configuration.

Fields available in the package

Here are the fields that they find concerning automatic dunning on the Invoice objet:

  • Automatic dunning - Checkbox: checked by the scheduled apex class MarkInvoiceForAutoReminder. The processes that we explain in the next article are triggered - among others - by this checkbox.

  • Last Dunning Date - Date: field that is filled out by the process that will be created by you to keep the date of the last dunning email sent out.

  • Term - Date: maximum deadline for the payment of the invoice

  • Payment Due on - Date: date when the next payment is expected

  • Follow-Up Level - Picklist: You can add levels if you want or use less:

  • R0: no incident

  • R1: 1st email sent

  • R2: 2nd email sent

  • R3: 3rd email sent (last reminder before formal notice)

  • R4: formal notice

These fields represent the minimum to configure the automatic dunning process.

In order to adapt the dunning process to the needs of the company, additional fields need to be created. Vijay and Linda are talking with the accounting department to define the correct dunning conditions.


Additional fields to create for the dunning process

In order to make the dunning process work, please add all these fields.

IMPORTANT: Formulas, descriptions and help texts are to be adapted to your business context / need. For each condition in this article, please ask yourself: is it relevant to your business? otherwise adapt it or remove it.


Steps

1. Go to Setup > Object Manager > OBJECT ACCORDING TO THE FIELD YOU WANT TO CREATE
2. Click on Fields & Relationships
3. Click on New
4. Follow the wizard and add the information ACCORDING TO THE FIELD YOU WANT TO CREATE

For more details, please read these trailhead articles:

Input Fields

Here is the list of input fields to create, for more information, click on the links:

  1. Do not remind before the

  2. Dunning Intensity

Formula Fields

Then we proceed to the configuration of the formula fields.
Note: When creating the formula fields, you may receive this type of error message:

The compiled formula is too large to be executed (9,501 characters). Maximum size of 5,000 characters (Associated field: Formula)

If your formulas are very complex or reference other formulas with many conditions, you can also use processes to work around the limits of Salesforce. We will show examples in the next chapter.

Here is the list of formula fields to create, for more information, click on the links:

Note: To avoid problems when saving formulas, be sure to:

(1) follow the order in which they were created,

(2) pay attention to the field name, replacing with letters (e.g., Field label: Follow-up Intensity > Field name suggested by Salesforce: Follow-upIntensity, replace the _ with an e without an accent).

The fields in detail

Here are the sample formulas and information for configuring the fields.

Reminder: Formulas, descriptions and help texts are to be adapted to your business context / need. For each condition in this article, please ask yourself: is it relevant to your business? otherwise adapt it or remove it.

Do not remind before the

Field Name: Do_not_remind_before_the
Object: Account
Data Type Date

  • Allows you to record the date (included) until which no reminder should start.

  • Taken into account by the field Do not remind on the Invoice object.

Here is the result for Cloud Kicks :

Dunning Intensity

Nom du champ : Dunning_Intensity
Object: Invoice
Data type: picklist

  • Allows you to configure the desired intensity of the dunning process in order to vary the frequency of reminder emails. You may wish that a client is reminded again within a shorter laps of time, thus you will choose a higher intensity.

  • List values:

    • Neutral - I0 (by default)

    • Emphasized - I1

    • Insistent - I2

Here is the result for Cloud Kicks:




Field Name: Payment_Date
Object: Invoice
Data Type: Formula (Date)        

  • Allows you to define the date on which a payment is expected.

  • Corresponds to the Term or Payment Due on if this field is not blank.

Based on those packaged fields:

  • Payment Due on (sofactoapp__R_glement_attendu_le__c)

  • Term (sofactoapp__Ech_ance__c)

Packaged fields might have french API names.      

Formula example:

IF(ISBLANK(sofactoapp__R_glement_attendu_le__c),
sofactoapp__Ech_ance__c,
sofactoapp__R_glement_attendu_le__c)



Here is the result for Cloud Kicks:



Do not remind

Field Name: Do_not_remind
Object : Invoice
Data Type: Formula (Check box)        

  • Allows you to indicate not to remind if the date Do not remind before the on the Account is after today.

  • Taken into account in the anomalies of the automatic dunning process.

  • Based on the field Do not remind before the that ou created before on the account object.

Formula example:
sofactoapp__Compte__r.Do_not_remind_before_the >= TODAY()

Here is the result for Cloud Kicks:



Contact OK

Field Name: Contact_OK
Object: Invoice
Data Type: Formula (Check box)

  • Indicate whether a contact with an email address is available on the invoice.

  • Taken into account in the anomalies of the automatic dunning process.

Note: You may have already created this field during the previous configuration
Automation: Sent out of invoice PDF via email.

Here is the result for Cloud Kicks:

Formula example:
NOT(ISBLANK(sofactoapp__Contact__r.Email))



PDF OK

Field Name: PDF_OK
Object: Invoice
Data Type: Formula (Check box)

  • If this box is checked, the PDF is ready to be sent

  • Condition for sending PDF: PDF exists, invoice is not a proforma, invoice is issued

Note: You may have already created this field during the previous configuration Automation: Sent out of invoice PDF via email.



The formula is based on the packaged fields

  • PDF Invoice: sofactoapp__PDF_reference__c

  • Proforma Invoice: sofactoapp__Facture_Proforma__c

  • Draft: sofactoapp__Facture_brouillon__c


Here is the result for Cloud Kicks:

Formula example:
AND( NOT(ISBLANK( sofactoapp__PDF_reference__c )),
sofactoapp__PDF_reference__r.sofactoapp__Facture_Proforma__c = FALSE,
sofactoapp__PDF_reference__r.sofactoapp__Facture_brouillon__c = FALSE)



Dunning Reference Date

Field Name: Dunning_Reference_Date
Object: Invoice
Data Type: Formula (Date)

  • Allows to define the reference date for the dunning process thanks to the MAX between Payment Date and Last Dunning Date
  • Allows not to remind if a payment is expected or if a dunning email has been sent out recently

Reminder: The Payment Date corresponds to the Term or Payment Due on if this field is not blank.

The Last Dunning Date is a packaged field.

Here is the result for Cloud Kicks:

Formula example:
IF(Payment_Date__c-sofactoapp__Date_derniere_relance__c<=0, sofactoapp__Date_derniere_relance__c, Payment_Date__c)




Field Name: Automatic_dunning_exception
Object: Invoice
Data Type: Formula (Check box)

  • Used to define the exceptional cases where the dunning should not take place.

  • If this field is equal to true, no automatic dunning will be triggered.

The exceptional cases of the proposed formula (as an example):

  • Invoice is still a "Draft"

  • Balance due inferior or equals 0

  • Invoice type : Credit Note

  • Follow up level R4

  • Payment Method is Bank Transfer

  • Le mode de paiement est prélèvement

The formula is based on these packaged fields:        

  • Status (sofactoapp__IsDraft__c)

  • Balance due (sofactoapp__Solde_d__c)

  • Credit Note? (sofactoapp__IsCreditNote__c)

  • Payment Method (sofactoapp__Payment_mode__c)

  • Follow-up level (sofactoapp__Niveau_de_relance__c)

Formula example:
OR( sofactoapp__IsDraft__c,
sofactoapp__Solde_d__c <= 0,
sofactoapp__IsCreditNote__c,
ISPICKVAL(sofactoapp__Niveau_de_relance__c, "R4"),
ISPICKVAL(sofactoapp__Payment_mode__c, "Bank Transfer")
ISPICKVAL(sofactoapp__Payment_mode__c, "Credit Card") )


Here is the result for Cloud Kicks:



Automatic dunning exception (text)

Field Name: Automatic_dunning_exception_text
Object: Invoice
Data Type: Formula (Text)

  • Allows the user to understand the case of exception.

Formula example:
IF(sofactoapp__IsCreditNote__c,
"Credit Note",
IF( sofactoapp__IsDraft__c,
"Draft Invoice",
IF( sofactoapp__Solde_d__c <= 0,
"Invoice paid",
IF( ISPICKVAL(sofactoapp__Payment_mode__c, "Bank Transfer"),
"Payment via Bank Transfer",
IF( ISPICKVAL(sofactoapp__Payment_mode__c, "Credit Card"),
"Payment via Credit Card",
IF( ISPICKVAL(sofactoapp__Niveau_de_relance__c, "R4"),
"Formal notice already sent",
"Nothing to report" ))))))

Here is the result for Cloud Kicks:


Field Name: Automatic_dunning_anomaly
Object: Invoice
Data Type: Formula (Check box)

  • Used to define the cases of anomalies that need to be corrected

  • If this field is equal to true, no automatic dunning will be triggered.

The anomalies defined in the proposed formula:

  • No exception is detected AND

    • There is no contact or it does not have an email address

    • There is no defined "Dunning Intensity"

    • There is no defined "Follow-up level"

    • The "Do not remind" box on the account is checked

    • There is no PDF, the invoice is a proforma or draft

    • The "Dunning Reference Date" is blank

Formula example:
AND(Automatic_dunning_exception__c = FALSE,
OR(Contact_OK__c = FALSE,
ISPICKVAL(Dunning_Intensity__c,""),
ISPICKVAL(sofactoapp__Niveau_de_relance__c,""),
Do_not_remind__c,
PDF_OK__c = FALSE,
ISBLANK(Dunning_Reference_Date__c)
)
)

Here is the result for Cloud Kicks:



Automatic dunning anomaly (text)

Field Name: Auto_relance_anomalie_texte
Object: Invoice
Data Type: Formula (Text)

  • Allows the user to understand the case of anomaly that need to be corrected.

Formula example:
IF(Automatic_dunning_exception__c, "See automatic dunning exception",
IF(Do_not_remind__c,"The Account is currently on "Do not remind" mode",
IF(PDF_OK__c = FALSE,"No PDF, the invoice is a proforma or draft",
IF(Contact_OK__c = FALSE,"Contact without an email address",
IF(ISBLANK(Dunning_Reference_Date__c), "No reference date for the dunning process",
IF(ISPICKVAL(Dunning_Intensity__c,""),"No dunning intensity defined",
IF(ISPICKVAL(sofactoapp__Niveau_de_relance__c,""),"No follow up level defined",
"Nothing to report")
))))))

Here is the result for Cloud Kicks:



Dunning Frequency

Field Name: Dunning_Frequency
Object: Invoice
Data Type: Formula (Number) -  without decimals

  • Allows to define the number of days that are taken into account in order to determine the Next Dunning Date.

  • Depends on the Follow up Level and the Dunning intensity.

Calculation of the frequency by using this formula:

  • If Dunning Intensity = I1 (emphasized) and the Follow up level  "R3",5,"R4",4 for the other levels : 7. Thus 7 days before the dunning email R1 and R2, then 5 days, then 4.

  • If Dunning Intensity = I0 (neutral) and the Follow up level  "R2",15,"R3",10,"R4",5, for the other levels : 20. Thus 20 days before the dunning email R1, then 15 days, then 10 days and 5 days for the next dunning emails.

  • If Dunning Intensity = I2  (insistent), frequency = 4. Dunning email sent out every 4 days.

Note: According to the conditions specified in the fields Automatic dunning exception et Automatic dunning anomaly, it might not be possible to take into account the two conditions in the formula Dunning Frequency without getting an error message. Let's see how to configure a process with process builder as a workaround.

Here is the result for Cloud Kicks:

Formula example:

CASE(Dunning_Intensity__c,
"I1",
CASE(sofactoapp__Niveau_de_relance__c,"R3",5,"R4",4,7),
"I0",
CASE(sofactoapp__Niveau_de_relance__c,"R2",15,"R3",10,"R4",20), 4)


Next Dunning Date

Field Name: Next_Dunning_Date
Object: Invoice
Data Type: Formula (Date)

Formula example:
Dunning_Reference_Date__c
+Dunning_Frequency__c

  • Allows you to define the date on which the next dunning email will be sent, thanks to Dunning Reference Date plus Dunning Frequency.

  • Left blank, if Automatic dunning anomaly / exception equals true.


Note: In the
 Blank Field Handling section select the value Treat blank fields as blanks in order to leave the Next dunning date blank, if the Dunning Frequency is blank.

Here is the result for Cloud Kicks:

Field Name: Automatic_dunning_condition
Object: Invoice
Data Type: Formula (Check box)

  • Defines if the invoice should take part in the dunning process

  • If this case is true

    • Next Dunning Date is inferior or equals the date of today

    • The invoice is not an exception or an anomaly

    • The check box Do not remind is not checked on the Account

Note: According to the conditions specified in the fields Automatic dunning exception et Automatic dunning anomaly, it might not be possible to take into account the two conditions in the formula Dunning Frequency without getting an error message. Let's see how to configure a process with process builder as a workaround.

Exemple de formule :
AND
(Next_Dunning_Date__c <= TODAY(),
Automatic_dunning_exception__c = FALSE,
Automatic_dunning_anomaly__c = FALSE,
Do_not_remind__c = FALSE)

Make the fields available on the invoice page layout

After the creation of the fields, we will modify the display of these fields on the subject of the invoice.


Steps

  1. Go to Setup > Object Manager

  2. Click on the Invoice Object

  3. Click on Page Layout and open the page layouts your are currently using in your org.

  4. Drag and drop all the fields that we created before into the Dunning section :

5. Click on Save.

Now that the fields are available on the invoice, we will take care of the fields that we could not save before.
​​​​​​​