Because many of the actions taken by an agent in Commerce Service Center are captured in the agent audit log, as well as ticket activities, Commerce Service Center provides a convenient way of creating a ticket activity from an AgentEvent.

The process mirrors that of recording an audit event whereby an AgentEvent is routed to a recorder component, which saves the information in the repository. The recorders are mapped by the activity type. Commerce Service Center provides classes for the most common cases of creating activities from the events.

The following steps outline what is needed to record an AgentEvent as a ticket activity. This assumes that the AgentEvent and audit log repository definitions are already in place.

  1. Define the new activity type in the TicketingRepository. You can define the ticket activity much the same as the audit log definition for the same type. However, the ticket activity definition can be defined as needed to meet your requirements. However, the only source for the ticket activity information is the AgentEvent. For additional information, refer to the ATG Service Installation and Configuration Guide.

  2. Create the recorder components. The recorder component generates a ticket activity from an AgentEvent. Commerce Service Center provides two classes for the most common cases, the atg.commerce.csr.ticketing.
    TicketingActivityRecorder
    class and the TicketingPropertyUpdateRecorder class.

    The TicketingActivityRecorder class is the base class for a recorder and supports the following features:

    • Automatic creation of the ticket activity repository item based on the type contained in the AgentEvent

    • The ability to configure a list of event properties that map to ticket activity properties. The recorder automatically sets the values in the activity from those in the AgentEvent

    • Automatic addition of the activity to the ticket ID referenced in the AgentEvent

    • Automatic association of the order with the ticket. (Note that this only occurs when the AgentEvent contains an orderId property)

    • The ability to configure if the order related ticket activity should be added when the order is in a transient state

    • Automatic saving of the ticket after adding the activity

    The TicketingPropertyUpdateRecorder class is an extension of TicketingActivityRecorder that supports recording an AgentEvent that contains a List or PropertyUpdates. For example:

    /myapp/recorders/LoyaltyPointRecorder

      class=atg.commerce.csr.ticketing.TicketingActivityRecorder
      applicationName=MyApplicationName
      internalProfileRepository=/atg/userprofiling/InternalProfileRepository
      orderRepository=/atg/commerce/order/OrderRepository
      profileRepository=/atg/userprofiling/ProfileAdapterRepository
      ticketingManager=/atg/ticketing/TicketingManager

      customProperties=\
      pointsRedeemed=pointsRedeemed,\
      orderId=orderId

      CSRAgentTools=/atg/commerce/custsvc/util/CSRAgentTools
      ordersPropertyName=orders
      saveTransientOrderActivities=false

  3. Register the recorder component by activity type. Map the new recorder component by its activity type so an AgentEvent of the same type will be routed to it for processing. For example:

    /atg/commerce/custsvc/ticketing/TicketingEventListener.properties#13
    $$Change: 447205 $

    eventTypeToRecorderMap+=\
      RedeemedLoyaltyPoints=/myapp/recorders/LoyaltyPointRecorder