Hi,
Requirement : Enhancement in which Actions are needed to build in Interaction record in UTIL_IC agent.
Design :
UI Component : GSACTIONS
View : GSACTIONS/Actions
Enhance this view in your enhancement set. redefine the method set_view_group_context and add the code
IF IV_PARENT_CONTEXT IS INITIAL.
CREATE OBJECT ME->VIEW_GROUP_CONTEXT TYPE CL_BSP_WD_VIEW_GROUP_CONTEXT.
VIEW_GROUP_CONTEXT->SET_VIEW_EDITABLE( ME ).
ELSE.
ME->VIEW_GROUP_CONTEXT = IV_PARENT_CONTEXT.
ENDIF.
now got to component ICCMP_BT_ACT.
create a component usage for the GSACTIONS/Actions. Please note standard have already exposed the required view in GSACTIONS. once you have created the component usage go to component structure browser and create an overview page. I created an overpage because action AB contains some important fields in it view and all ae required to be visible completely on view. Adding it in ICCMP_BT_ACT/ActViewSet would have added it to the area between notes and notes log which would have not displayed all fields.
So create an overview page. Assign the ICCMP_BT_ACT/ActViewSet and component usage view
Now build one custom controller with model nodes for BTadmiH and ACIActionContext and bind the first one with component controller.
Create the ON_NEW_FOCUS for ACIACTIONCONTEXT and add the code
entity ?= focus_bo.
TRY.
lv_collection = entity->get_related_entities(
iv_relation_name = 'BTHeaderAction' ).
CATCH cx_crm_genil_model_error.
* should never happen
EXIT.
CATCH cx_sy_ref_is_initial.
ENDTRY.
me->collection_wrapper->set_collection( lv_collection ).
BTHeaderAction relation is used to get the object id.
Now go to your component controller and redefine it and in wd_usage_initialize bind the nodes with usage name with the code
WHEN 'ScheduledActions'.
IV_USAGE->BIND_CONTEXT_NODE(
IV_CONTROLLER_TYPE = CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM
IV_TARGET_NODE_NAME = 'ACIACTIONCONTEXT' "#EC NOTEXT
IV_NAME = '/PES/ICCMP_BT_ACT/CuActionCuco' "#EC NOTEXT
IV_NODE_2_BIND = 'ACTIONCONTEXT' ). "#EC NOTEXT
IV_USAGE->BIND_CONTEXT_NODE(
IV_CONTROLLER_TYPE = CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM
IV_TARGET_NODE_NAME = 'BTADMINH' "#EC NOTEXT
IV_NAME = '/PES/ICCMP_BT_ACT/CuActionCuco' "#EC NOTEXT
IV_NODE_2_BIND = 'PARENTNODE' ). "#EC NOTEXT
here we need to understand that we are taking into consideration custom controller so for GSACTIONS also we have to take the same. once nodes are bound,
in connect_nodes of CTXT class , create the handler fro focus_bo.
COLL_WRAPPER = ME->BTADMINH->GET_COLLECTION_WRAPPER( ).
SET HANDLER ME->ACIACTIONCONTEXT->ON_NEW_FOCUS
FOR COLL_WRAPPER ACTIVATION IV_ACTIVATE.
After this in order to rename your overview page add the code :
LR_ENTITY = ME->TYPED_CONTEXT->BTADMINH->COLLECTION_WRAPPER->GET_CURRENT( ).
CHECK LR_ENTITY IS BOUND.
OBJECT_ID = LR_ENTITY->GET_PROPERTY_AS_STRING( IV_ATTR_NAME = 'OBJECT_ID').
PROCESS_TYPE = LR_ENTITY->GET_PROPERTY_AS_STRING( IV_ATTR_NAME = 'PROC_TYPE_DESCR').
CONCATENATE PROCESS_TYPE ':' OBJECT_ID INTO TITLE.
IF OBJECT_ID IS INITIAL.
DESCRIPTION = CL_CRM_UIU_BT_TOOLS=>GET_TITLE_HEADER( LR_ENTITY ).
ELSE.
DESCRIPTION = TITLE.
ENDIF.
You will be getting your desired result as shown below :