Logging assignment activity

Guidewire recommends also that you log the action anytime that you use one of the assignment methods. Class gw.assignment.AsssignmentUtil provides several helper methods for logging assignment changes. These include the following:

  • assignAndLogUserRole
  • logUserRoleAssignment

To see examples of the use of these logging methods, see JobAssignmentEnhancement in the same package. For example, the following method uses assignAndLogUserRole to log information about the assignment process:

/**
 * Assign roles from the Policy to the Job
 */

function assignRolesFromPolicy() {
 
  var producer = this.Policy.getUserRoleAssignmentByRole( "producer" )
  if (producer != null) {
    AssignmentUtil.assignAndLogUserRole( this, producer.AssignedUser, producer.AssignedGroup, "producer", 
          "Job.assignRolesFromPolicy()" )
  }
 
  var underwriter = this.Policy.getUserRoleAssignmentByRole( "underwriter" )
  if (underwriter != null) {
    AssignmentUtil.assignAndLogUserRole( this, underwriter.AssignedUser, underwriter.AssignedGroup, 
          "underwriter", "Job.assignRolesFromPolicy()" )
  }
}