Event Hooks

On this page, you will find information for implementing Event Publishers to Collection Management.

If the need for other event points emerge, send us a request for new ones by creating a ticket in our support system.

Event Description:
The event is published to add notification lines before the header line notification.
Codeunit: 6052637
Event Name: OnBeforeCreateCollJnlAdviceHeaderInfo
Event Type: Integration
Parameters: GlobalCollAdviceDef : Record "CCM Coll. Notification Def.";CollJnlLine : Record "Gen. Journal Line";CustLedgEntry : Record "Cust. Ledger Entry";NoOfAdvChar : Integer;VAR AdvLineNo : Integer;CollEntryNo : Integer
Published Version: 8.02.00 / 8.2.0.0

Example on how to utilize the event

    [EventSubscriber(Codeunit,6052637,OnBeforeCreateCollJnlAdviceHeaderInfo)]
    LOCAL PROCEDURE OnBeforeCreateCollJnlAdviceHeaderInfoTest@3(GlobalCollAdviceDef@1000 : Record 6052642;CollJnlLine@1001 : Record 81;CustLedgEntry@1002 : Record 21;NoOfAdvChar@1003 : Integer;VAR AdvLineNo@1004 : Integer;CollEntryNo@1005 : Integer);
    VAR
      CollEntryAdvice@1006 : Record 6052648;
    BEGIN
      CollEntryAdvice."Coll. Entry No." := CollEntryNo;
      AdvLineNo += 10000;
      CollEntryAdvice."Line No." := AdvLineNo;
      CollEntryAdvice.Type := CollEntryAdvice.Type::Normal;
      CollEntryAdvice."Advice Description" := 'Some extra info';
      CollEntryAdvice.INSERT;
    END;

Event Description:
The event is published to add notification lines after the header line notification.
Codeunit: 6052637
Event Name: OnAfterCreateCollJnlAdviceHeaderInfo
Event Type: Integration
Parameters: (CollJnlLine : Record "Gen. Journal Line";CustLedgEntry : Record "Cust. Ledger Entry";NoOfAdvChar : Integer;VAR AdvLineNo : Integer;CollEntryNo : Integer)
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052637,OnAfterCreateCollJnlAdviceHeaderInfo)]
LOCAL PROCEDURE HeaderInfoTest@1(CollJnlLine@1000 : Record 81;CustLedgEntry@1001 : Record 21;NoOfAdvChar@1002 : Integer;VAR AdvLineNo@1003 : Integer;CollEntryNo@1004 : Integer);
VAR
  CollEntryAdvice@1005 : Record 6052648;
BEGIN
  CollEntryAdvice."Coll. Entry No." := CollEntryNo;
  AdvLineNo += 10000;
  CollEntryAdvice."Line No." := AdvLineNo;
  CollEntryAdvice.Type := CollEntryAdvice.Type::Normal;
  CollEntryAdvice.Bold := TRUE;
  CollEntryAdvice."Advice Description" := CustLedgEntry.Description;
  CollEntryAdvice.INSERT;
END;
Event Description:
The event is published to add notification lines at the end of the notification for collected lines (Applies-to ID) and reminders.
Codeunit: 6052637
Event Name: OnAfterCreateAdviceDocPrCollection
Event Type: Integration
Parameters: GlobalCollAdviceDef : Record 6052642;CollJnlLine : Record 81;CustLedgEntry : Record 21;AmountExclVAT : Decimal;VATAmount : Decimal;AmountInclVAT : Decimal;NoOfAdvChar : Integer;VAR AdvLineNo : Integer;CollEntryNo : Integer
Published Version: 8.02.00 / 8.2.0.0

Example on how to utilize the event

    [EventSubscriber(Codeunit,6052637,OnAfterCreateAdviceDocPrCollection)]
    LOCAL PROCEDURE OnAfterCreateAdviceDocPrCollectionTest@1(GlobalCollAdviceDef@1000 : Record 6052642;CollJnlLine@1001 : Record 81;CustLedgEntry@1002 : Record 21;AmountExclVAT@1003 : Decimal;VATAmount@1004 : Decimal;AmountInclVAT@1005 : Decimal;NoOfAdvChar@1006 : Integer;VAR AdvLineNo@1007 : Integer;CollEntryNo@1008 : Integer);
    VAR
      CollEntryAdvice@1009 : Record 6052648;
    BEGIN
      CollEntryAdvice."Coll. Entry No." := CollEntryNo;
      AdvLineNo += 10000;
      CollEntryAdvice."Line No." := AdvLineNo;
      CollEntryAdvice.Type := CollEntryAdvice.Type::Normal;
      CollEntryAdvice."Advice Description" := CustLedgEntry."Applies-to ID" + ' (' + FORMAT(AmountInclVAT) + ')';
      CollEntryAdvice.INSERT;
    END;
Event Description:
The event is published to add notification lines at the end of the notification for single document lines (Applies-to Doc. Type/Applies-to Doc. No.)
Codeunit: 6052637
Event Name: OnAfterCreateAdvicePrInvoice
Event Type: Integration
Parameters: GlobalCollAdviceDef : Record 6052642;CollJnlLine : Record 81;CustLedgEntry : Record 21;AmountExclVAT : Decimal;VATAmount : Decimal;AmountInclVAT : Decimal;NoOfAdvChar : Integer;VAR AdvLineNo : Integer;CollEntryNo : Integer
Published Version: 8.02.00 / 8.2.0.0

Example on how to utilize the event

    [EventSubscriber(Codeunit,6052637,OnAfterCreateAdvicePrInvoice)]
    LOCAL PROCEDURE OnAfterCreateAdvicePrInvoiceTest@8(GlobalCollAdviceDef@1000 : Record 6052642;CollJnlLine@1001 : Record 81;CustLedgEntry@1002 : Record 21;AmountExclVAT@1003 : Decimal;VATAmount@1004 : Decimal;AmountInclVAT@1005 : Decimal;NoOfAdvChar@1006 : Integer;VAR AdvLineNo@1007 : Integer;CollEntryNo@1008 : Integer);
    VAR
      CollEntryAdvice@1009 : Record 6052648;
    BEGIN
      CollEntryAdvice."Coll. Entry No." := CollEntryNo;
      AdvLineNo += 10000;
      CollEntryAdvice."Line No." := AdvLineNo;
      CollEntryAdvice.Type := CollEntryAdvice.Type::Normal;
      CollEntryAdvice."Advice Description" := 'Amount Incl. VAT: ' + FORMAT(AmountInclVAT);
      CollEntryAdvice.INSERT;
    END;
Event Description:
The event is published to add notification lines at the end of the Collection Journal Line notification.
Codeunit: 6052637
Event Name: OnCreateAdvice
Event Type: Integration
Parameters: (CollJnlLine : Record "Gen. Journal Line";CollEntryNo : Integer;VAR AdvLineNo : Integer)
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Codeunit,6052637,OnCreateAdvice)]
LOCAL PROCEDURE AdviceTest@1160040000(CollJnlLine@1160040000 : Record 81;CollEntryNo@1160040001 : Integer;VAR AdvLineNo@1160040002 : Integer);
VAR
  CollEntryAdvice@1160040004 : Record 6052648;
BEGIN
  IF CollJnlLine."Account No." = '10000' THEN BEGIN
    CollEntryAdvice.INIT;
    CollEntryAdvice."Coll. Entry No." := CollEntryNo;
    AdvLineNo += 10000;
    CollEntryAdvice."Line No." := AdvLineNo;
    CollEntryAdvice."Advice Description" := 'Test advisering';
    CollEntryAdvice.INSERT;

    AdvLineNo += 10000;
    CollEntryAdvice."Line No." := AdvLineNo;
    CollEntryAdvice."Advice Description" := 'Test advisering - linje 2';
    CollEntryAdvice.INSERT;
  END;
END;  
Event Description:
The event is published to add notification lines after the document no. line.
On the Notification template the field "Limit to document no." must be activated.
Codeunit: 6052637
Event Name: OnAfterCreateCollJnlAdviceDocNosOnly
Event Type: Integration
Parameters: (CollJnlLine : Record "Gen. Journal Line";NoOfAdvChar : Integer;VAR AdvLineNo : Integer;CollEntryNo : Integer)
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052637,OnAfterCreateCollJnlAdviceDocNosOnly)]
LOCAL PROCEDURE DocNosOnlyTest@2(CollJnlLine@1000 : Record 81;NoOfAdvChar@1001 : Integer;VAR AdvLineNo@1002 : Integer;CollEntryNo@1003 : Integer);
VAR
  CollEntryAdvice@1005 : Record 6052648;
  CustLedgEntry@1004 : Record 21;
  DescriptionText@1006 : Text;
BEGIN
  //NB!
  // IF CollJnlLine."Applies-to ID" <> '' THEN multiple Customer Ledger Entries is collected to one Collection Journal Line.
  // Use CollJnlLine."Applies-to ID" to find all Customer Ledger Entries if needed.
  // Find Customer Ledger Entries if needed...
  IF CollJnlLine."Applies-to ID" <> '' THEN BEGIN
    CustLedgEntry.SETCURRENTKEY("Customer No.","Applies-to ID",Open,Positive,"Due Date");
    CustLedgEntry.SETRANGE("Customer No.",CollJnlLine."Account No.");
    CustLedgEntry.SETRANGE(Open,TRUE);
    CustLedgEntry.SETRANGE("Applies-to ID",CollJnlLine."Applies-to ID");
    IF CustLedgEntry.FINDSET THEN
      REPEAT
        DescriptionText += CustLedgEntry.Description + ', ';
      UNTIL CustLedgEntry.NEXT = 0;
  END ELSE BEGIN
    IF CollJnlLine."CCM Cust. Ledger Entry No." <> 0 THEN
      CustLedgEntry.GET(CollJnlLine."CCM Cust. Ledger Entry No.");
      DescriptionText := CustLedgEntry.Description;
  END;
  CollEntryAdvice."Coll. Entry No." := CollEntryNo;
  AdvLineNo += 10000;
  CollEntryAdvice."Line No." := AdvLineNo;
  CollEntryAdvice.Type := CollEntryAdvice.Type::Normal;
  CollEntryAdvice.Bold := TRUE;
  CollEntryAdvice."Advice Description" := DescriptionText;
  CollEntryAdvice.INSERT;
END;
Event Description:
The event is published to modify the Gen. Journal Line before the the Status field is updated.
Codeunit: 6052637
Event Name: OnBeforeCollJnlUpdateStatus
Event Type: Integration
Parameters: (VAR CollJnlLine : Record "Gen. Journal Line",ExitUpdateStatus : Boolean)
Published Version: 7.01.00 / 7.1.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052637,OnBeforeCollJnlUpdateStatus)]
LOCAL PROCEDURE OnBeforeCollJnlUpdateStatus@7(VAR CollJnlLine@1000 : Record 81;VAR ExitUpdateStatus@1001 : Boolean);
BEGIN
// Demosystem code:
    ExitUpdateStatus := TRUE; // Will stop the Import Status function.
    CollJnlLine."CCM Status" := CollJnlLine."CCM Status"::Processing;
    CollJnlLine.MODIFY;
END;
Event Description:
The event is published to modify the Gen. Journal Line before the Balance Entry is created.
Codeunit: 6052637
Event Name: OnCreateBalEntry
Event Type: Integration
Parameters: (VAR CollJnlLine : Record "Gen. Journal Line")
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052637,OnCreateBalEntry)]
LOCAL PROCEDURE OnCreateBalEntryTest@1160040000(VAR CollJnlLine@1000 : Record 81);
BEGIN
  CollJnlLine.Description = 'Ny modpost beskrivelse - test’;
END;
Event Description:
The event is published to modify the Gen. Journal Line before the Collected line in the Collection Journal is Modified.
Codeunit: 6052637
Event Name: OnCollectCollJnlLines
Event Type: Integration
Parameters: (VAR CollJnlLine : Record "Gen. Journal Line")
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052637,OnCollectCollJnlLines)]
LOCAL PROCEDURE OnCollectLineTest@1160040000(VAR CollJnlLine@1000 : Record 81);
BEGIN
  CollJnlLine.Description = 'Samlede opkrævninger - test’;
END;
Event Description:
The event is published to alter the collection journal lines before they are inserted into the Collection Journal.
The Collection Journal lines are based on invoices/credit memos.
Report: 6052638
Event Name: OnBeforeInsertColJnlLine
Event Type: Integration
Parameters: (VAR NewCollJnlLine : Record "Gen. Journal Line";CustLedgEntry : Record "Cust. Ledger Entry")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the event

[EventSubscriber(Report,6052638,OnBeforeInsertCollJnlLine)]
LOCAL PROCEDURE test@1160040001(VAR NewCollJnlLine@1160040000 : Record 81;CustLedgEntry@1160040001 : Record 21);
BEGIN
  IF CustLedgEntry."Customer No." = '10000' THEN
    NewCollJnlLine.Description := 'Test tekst';
END;
Event Description:
The event is published to alter the collection journal lines before they are inserted into the Collection Journal.
The Collection Journal lines are based on reminders.
Report: 6052638
Event Name: OnBeforeInsertCollJnlLineReminder
Event Type: Integration
Parameters: (VAR NewCollJnlLine : Record "Gen. Journal Line";IssRemHeader : Record "Issued Reminder Header")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the event

[EventSubscriber(Report,6052638,OnBeforeInsertCollJnlLineReminder)]
LOCAL PROCEDURE test2@1160040004(VAR NewCollJnlLine@1160040000 : Record 81;IssRemHeader@1160040001 : Record 297);
BEGIN
  IF IssRemHeader."Customer No." = '10000' THEN
    NewCollJnlLine.Description := 'Test rykker tekst';
END;
Event Description:
The event is published to alter the PDF templates that are to be applied to the mail notifications.
Codeunit: 6052645
Event Name: OnBeforePrintToFile
Event Type: Integration
Parameters: (CustLE : Record "Cust. Ledger Entry";VAR ReportID : Integer)
Published Version: 4.00.00 / 4.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052645,OnBeforePrintToFile)]

LOCAL PROCEDURE test@1160040000(CustLE@1160040000 : Record 21;VAR ReportID@1160040001 : Integer)
  BEGIN
   CASE CustLE."Document Type" OF
    CustLE."Document Type"::Invoice: ReportID := 206;
    CustLE."Document Type"::"Credit Memo": ReportID := 207;
    CustLE."Document Type"::Reminder: ReportID := 117;
   END;
  END;
Event Description:
The event is published to modify the Coll. Entry when a line is created in Collection Journal.
Codeunit: 6052647
Event Name: OnAfterInsertEntry
Event Type: Integration
Parameters: (VAR CollEntry : Record "CCM Collection Entry";CollJnlLine : Record "Gen. Journal Line")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Table,6052647,OnAfterInsertEntry)]
LOCAL PROCEDURE InsertEntryTest@1160040003(VAR CollEntry@1160040000 : Record 6052647;CollJnlLine@1160040001 : Record 81);
BEGIN
  IF CollJnlLine."Account No." = '10000' THEN
    CollEntry."E-Mail advice Sent" := TRUE;
END;
Event Description:
The event is published to modify the Coll. Entry when the funcition ModifyEntry on Table CCM Coll. Entry is called.
Codeunit: 6052647
Event Name: OnAfterUpdateEntry
Event Type: Integration
Parameters: (VAR CollEntry : Record "CCM Collection Entry";CollJnlLine : Record "Gen. Journal Line")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Table,6052647,OnAfterUpdateEntry)]
LOCAL PROCEDURE UpdateEntryTest@1160040005(VAR CollEntry@1160040000 : Record 6052647;CollJnlLine@1160040001 : Record 81);
BEGIN
  IF CollJnlLine."Account No." = '10000' THEN
    CollEntry."Recipient Email" := 'testmail@continia.dk';
END;
Event Description:
The event is published to modify the Gen. Journal Line created when using the function "Transfer to Cash receipt Jnl." from the Collection Import Journal.
Codeunit: 6052648
Event Name: OnAfterCreateCashReceipt
Event Type: Integration
Parameters: (VAR GenJnlLine : Record "Gen. Journal Line";CollImportJnlLine : Record "CCM Import Journal Line")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Codeunit,6052648,OnAfterCreateCashReceipt)]
LOCAL PROCEDURE AfterCashReceiptTest@1160040002(VAR GenJnlLine@1160040000 : Record 81;CollImportJnlLine@1160040001 : Record 6052667);
BEGIN
  IF GenJnlLine."Account No." = '10000' THEN BEGIN
    GenJnlLine.Comment := 'Test';
  END;
END;
Event Description:
The event is published to modify the Gen. Journal Line before the Refund line is inserted into the Collection Journal from the Collection Import Journal.
Codeunit: 6052648
Event Name: OnBeforeInsertRefundLinesInCollJnl
Event Type: Integration
Parameters: (VAR GenJnlLine : Record "Gen. Journal Line";CollImportJnlLine : Record "CCM Import Journal Line")
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052648,OnBeforeInsertRefundLinesInCollJnl)]
LOCAL PROCEDURE BeforeReminderInsertTest@1160040002(VAR GenJnlLine@1160040000 : Record 81;CollImportJnlLine@1160040001 : Record 6052667);
BEGIN
  GenJnlLine.Description = 'LS-tilbageført betaling’;
END;
Event Description:
Export collection file BS XML000 (Collection system Betalingsservice med FI and Betalingsservice uden FI)
The event is published to export your own Customer CVR or CPR No. in the field DebtorCVROrCPRNr
Codeunit: 6052692
Event Name: ExportCollectionsSetDebtorCVROrCPRNr
Event Type: Integration
Parameters: (Customer : Record Customer;VAR CVROrCPR : Text)
Published Version: 7.00.00 / 7.0.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052692,ExportCollectionsSetDebtorCVROrCPRNr)]
LOCAL PROCEDURE BetalingsserviceCVRCPRTest@3(Customer@1000 : Record 18;VAR CVROrCPR@1001 : Text);
BEGIN
  IF Customer."No." = '10000' THEN
    CVROrCPR := '0101011234';
END;
Event Description:
The event is published to alter Customer."VAT Registration No." when exporting collection lines for Betalingsservice.
Codeunit: 6052692
Event Name: ExportCollectionsSetCustValues
Event Type: Integration
Parameters: (VAR Customer : Record Customer)
Published Version: 6.03.00 / 6.3.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052692,ExportCollectionsSetCustValues,"",Skip,Skip)]
  LOCAL PROCEDURE Test2@3(VAR Customer@1000 : Record 18);
    BEGIN
      Customer."VAT Registration No." := CPRFunctions.GetCustCPRNo(Customer."No.");
      Customer.Name += ' Test';
    END;
Event Description:
The event is published to alter Customer."VAT Registration No." when creating an agreement for Betalingsservice.
Codeunit: 6052692
Event Name: CreateNewAgreementSetCustVatRegNo
Event Type: Integration
Parameters: (VAR Customer : Record Customer)
Published Version: 6.03.00 / 6.3.0.0

Example on how to utilize the event

[EventSubscriber(Codeunit,6052692,CreateNewAgreementSetCustVatRegNo,"",Skip,Skip)]
LOCAL PROCEDURE Test@1(VAR Customer@1000 : Record 18);
  BEGIN
    Customer."VAT Registration No." := CPRFunctions.GetCustCPRNo(Customer."No.");
  END;
Event Description:
The event is published to modify the Collection Agreements being created from the Agreement Export Journal.
Codeunit: 6052692
Event Name: ExportAgreementsCreateOnBeforeModifyAgree
Event Type: Integration
Parameters: (VAR CollAgree : Record "CCM Collection Agreement";AgreeJnlLine : Record "CCM Coll. Agreement Jnl. Line")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Codeunit,6052692,ExportAgreementsCreateOnBeforeModifyAgree)]
LOCAL PROCEDURE ExportAgreementTest@1160040006(VAR CollAgree@1160040000 : Record 6052640;AgreeJnlLine@1160040001 : Record 6052654);
BEGIN
  IF CollAgree."Customer No." = '10000' THEN
    CollAgree.Description :=  'Agreement export test'
END;
Event Description:
The event is published to set your own value for the tag in the Collection file exported to Nets BetalingsService.
Codeunit: 6052692
Event Name: ExportCollectionsSetDebtorCustomerNr
Event Type: Integration
Parameters: (CollJnlLine : Record "Gen. Journal Line";VAR DebtorCustomerNr : Code[30])
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Codeunit,6052692,ExportCollectionsSetDebtorCustomerNr)]
LOCAL PROCEDURE SetDebtorCustomerNrTest@1160040007(CollJnlLine@1160040000 : Record 81;VAR DebtorCustomerNr@1160040001 : Code[30]);
BEGIN
  DebtorCustomerNr := CollJnlLine."Contract No.";
END;
Event Description:
The event is published to get the Coll. Journal Line after the line is exported to Nets BetalingsService.
Codeunit: 6052692
Event Name: ExportCollectionsOnAfterModify
Event Type: Integration
Parameters: (VAR CollJnlLine : Record "Gen. Journal Line")
Published Version: 5.00.00 / 5.0.0.0

Example on how to utilize the events

[EventSubscriber(Codeunit,6052692,ExportCollectionsOnAfterModifyCollJnlLine)]
LOCAL PROCEDURE GetCollJnlLineAferExportCollectionTest@1160040008(VAR CollJnlLine@1160040000 : Record 81);
BEGIN
  CollJnlLine.Description := 'Exported';
  CollJnlLine.MODIFY;
END;