Restrict AutoSave on End Button in IC-Agent Role
Agent or User whenever click the End Button in Web IC, Interaction center is designed in such a way that all unsaved data from current customer interaction data with its all business object/links gets Saved.
The purpose of the document is to stop or restrict auto-save in IC-Agent role.
In this document IC role, I would like to take example of Service request – If an Agent is trying to create a new service request and if he push End button on a toolbar, System should not save the service request data and navigate to Account Identification page.
Step 1. Open to the Service request component SRQM_INCIDENT_H, from bsp_wd_cmpwb tcode.
Step 2. Open the Header View SRQM_INCIDENT_H/IncidentHeaderEF
Step 3. In the View IMPL class add a new IC event service interface IF_CRM_IC_EVENT_LISTENER
This controller implementation class will show you that it has a method HANDLE_EVENT that
accepts the event name as parameter, that further will have to be implemented.
Step 4. Before implementing Handle_event we first must subscribe this handler to the event to which it will be listening.
This can be done in DO_VIEW_INIT_ON_ACTIVATION method, this method is generally used for registering handlers.
CALL METHOD SUPER->DO_VIEW_INIT_ON_ACTIVATION. DATA : lr_event_srv TYPE REF TO if_crm_ic_event_srv. lr_event_srv = cl_crm_ic_services=>get_event_srv_instance( ). lr_event_srv->subscribe( event_name = cl_crm_ic_interaction_manager=>event_interaction_end_request listener = me prio = '1').
Step 5. Next to code in Handle_event method of IC controller implementation class in which event is registered as handler.
When Agent clicks on End button Event_interaction_end_request is called, and here is a code to revert the transaction before saving.
DATA : lr_entity TYPE REF TO cl_crm_bol_entity. DATA : lr_tx TYPE REF TO if_bol_transaction_context. DATA: lv_guid TYPE crmt_object_guid. DATA : lr_core TYPE REF TO cl_crm_bol_core. DATA : lr_comp TYPE REF TO zl_srqm_bspwdcompone0_impl. CASE event->get_name( ). WHEN cl_crm_ic_interaction_manager=>event_interaction_end_request. lr_comp ?= me->comp_controller. IF lr_comp IS BOUND. lr_entity ?= lr_comp->typed_context->btadminh->collection_wrapper->get_current( ). CHECK lr_entity IS BOUND. CALL METHOD lr_entity->if_bol_bo_property_access~get_property_as_value EXPORTING iv_attr_name = 'GUID' IMPORTING ev_result = lv_guid. lr_core = cl_crm_bol_core=>get_instance( ). lr_entity = lr_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = lv_guid ). IF lr_entity->alive( ) EQ abap_true. lr_tx = lr_entity->get_transaction( ). IF lr_tx IS BOUND. lr_tx->revert( iv_suppress_buffer_sync = abap_true ). ENDIF. ENDIF. ENDIF. ENDCASE.
If you want to check the functionality of End button, you can open a component CRMCMP_IC_FRAME
View -> CRMCMP_IC_FRAME/HiddenView, Method EH_ONFORWARDCALL is implemented in class
you can debug the standard code this below raise method will call handle event which we have implemented and revert the transaction.
ref_event_service->raise( ref_event )
Please also refer for more information check How To Stop Auto Save while clicking End Transaction Button in Ic_agent Buss Role