Configuring job history events

History events record the progress of a job (policy transaction). PolicyCenter displays history events in the History menu link in the Policy tab. In the default configuration, the submission and renewal jobs log history events. In addition, creating a new account and changing an account creates history events. You can add history events to a job by using the createCustomHistoryEvent method of the Job class. This method has two signatures:

  • The first createCustomHistoryEvent method creates a History with the given CustomHistoryType and description. The description argument is wrapped in a block so that it can be localized to the primary language of the policy or account.
    function createCustomHistoryEvent(type : CustomHistoryType, description : block() : String) : History
  • The second createCustomHistoryEvent method is similar, but allows you to provide the originalValue and newValue fields of the History.
    function createCustomHistoryEvent(type : CustomHistoryType, description : block() : String,
      originalValue : String, newValue : String) : History

For examples, view the job classes, such as RenewalProcess.gs, in Studio.

The History screen displays a Type and Description for each event. In Studio, type names are defined in the CustomHistoryType.ttx typelist. Descriptions are defined in Display Keys. The submission job display keys are defined in Submission.History entries. The renewal job display keys are defined in Job.Renewal.History entries. You can localize both the type and description.

Example Code that Localizes the Event Message to the Primary Language

The description argument of createCustomHistoryEvent is wrapped in a block so that it can be localized to the primary language of the policy or account. This example describes the code that does this.

Code in CancellationProcess.gs calls the Job.createCustomHistoryEvent method:

private function startScheduledCancellation(processDate : Date) {
  ...
  if (InitialNotificationsHaveBeenSent) {
      Job.createCustomHistoryEvent(CustomHistoryType.TC_CANCEL_RESCHEDULE, \ ->
         displaykey.Job.Cancellation.History.Reschedule(processDate))
  ...
}

The second parameter of createCustomHistoryEvent method is defined as:

description : block() : String

The description parameter is a method, block(), that returns a String. In code above, the parameter is the displaykey.Job.Cancellation.History.Reschedule method.

The createCustomHistoryEvent method contains code which temporarily switches the locale to the primary language of the policy and runs the description method. Therefore, the history event message is localized to the language of the policy.

See also