Initiate communication accounting

  1. On the Administration tab, click System Administration.
  2. Click the system object and, in the Accounting section on the right, set the OnCommunicationDistribution parameter to a script that has the CommunicationAccounting context.

    When the parameter is set, the configured script is called automatically whenever a communication is distributed.

The communication accounting exit point is called by the CCM_Conversion standard process once a print file is created in the configured output folder. The exit point is called once for each communication that is part of the print file. If the created print file completes requests, the request accounting exit point is called after the communication accounting exit point. This exit point is not called for abandoned communications.

The CommunicationAccounting context property makes the following information available to the configured communication accounting exit point:

  • Communication.RequestReference. Reference of the request with the distributed communication.
  • Communication.CorrespondenceReference. Reference of the correspondence with the distributed communication.
  • Communication.Label. Label of the distributed communication.
  • Communication.Channel. Name of the channel used to distribute the communication.
  • Communication.Printer. Name of the printer used to distribute the communication.
  • Communication.HasSender. Flag that indicates whether the sender information is available for the distributed communication.
  • Communication.GetSenderData(field). Function that produces the value of a contact field in the sender information of the distributed communication. Throws an exception if no sender information is available, or the contact field does not exist.
  • Communication.RecipientType. Recipient type of the distributed communication.
  • Communication.GetRecipientData(field). Function that produces the value of a contact field in the recipient information of the distributed communication. Throws an exception if the contact field does not exist.
  • Communication.GetOrganisationalMetadata(key). Function that produces the value of a key in the organizational metadata of the distributed communication. Throws an exception if the key does not exist.
  • Communication.DistributionTime. Time when the communication was distributed. The UTC time standard is used.
  • AccountingDatabase. Name of the database alias configured on the system for the accounting database. When no database is configured, this is the empty string.

Example communication accounting script


; Store accounting information in database, but only if an accounting database has been configured on the system.
If (AccountingDatabase <> "")

  ; Retrieve information from distributed communication.
  RequestReference = Communication.RequestReference
  CorrespondenceReference = Communication.CorrespondenceReference
  Label = Communication.Label
  Channel = Communication.Channel
  RecipientType = Communication.RecipientType

  ; Create INSERT query.
  StringListClear("Sql")
  StringListClear("SqlParameters")
  StringListAdd("Sql", "INSERT INTO AccountedCommunication VALUES (:RequestReference, :CorrespondenceReference, :Label, :Channel, :RecipientType)")
  StringListSetValue("SqlParameters", "RequestReference", "is")
  StringListSetValue("SqlParameters", "CorrespondenceReference", "is")
  StringListSetValue("SqlParameters", "Label", "is")
  StringListSetValue("SqlParameters", "Channel", "is")
  StringListSetValue("SqlParameters", "RecipientType", "is")

  ; Execute INSERT query.
  InitDatabase(AccountingDatabase)
  InitDataSet("DataSet", AccountingDatabase)
  SetExecSQL("DataSet", "Sql", "SqlParameters")
  CloseDatabase(AccountingDatabase)

End-If

This sample script is included in a B&OM installation. To use this script, you still must configure it on the system.