Hi,
Sometime there are requirements like where we need to Hide some work-center from the Navigation Bar profile based on some condition at run-time.
We all know that this can be done by creating two Business Roles with different Navigation Bar Profiles assigned to them.
Now suppose business do not want to use different business roles for this purpose and they want to go with only one business role Or
there might be requirement like Suppose in Interaction Center we need to Hide some Work centers from the Nav Bar Profile until the account will not get confirmed and Once the account gets confirmed the Work Center should be available on UI.
So here I will take simple example lets say we need to Hide the Work Center ‘Interaction Record’ from the Navigation Bar in IC Agent Role.
In this document I will be explaining how can we Hide Work center 'Interaction Record' from the Nav Bar Profile in IC Agent role if the account is not confirmed and once the account gets confirmed then we will make the 'Interaction Record' work center available in the Nav Bar Profile.
Step 1: Put the external debugger in the ‘MainNavigationLinks.htm’ page of the view ‘CRMCMP_NAVBAR/MainNavigationLinks’ under BSP component ‘CRMCMP_NAVBAR/MainNavigationLinks’ .
Now open your business Role in UI . The debugger will stop and just check the entries in ‘CONTROLLER->MENU_ITEMS’ .
As you can see in the Screen shot it contains all the Work-center Ids which we have made available in the Nav Bar Profile in the Configuration of Business Role and Navigation Bar Profile . Just note down the Work center details( that you want to Hide) from this Table . In our case its ‘Interaction Record’ as shown below:
Step 2. We need to Enhance the component ‘CRMCMP_NAVBAR’ and then the view ‘CRMCMP_NAVBAR/MainNavigationLinks’.
Now we are ready to make changes in the ‘MainNavigationLinks.htm’ page for our requirement.
Step 3: Put the below Code in the .htm page . It can be modified according to the Requirement. Please see added Comments in different sections of below code for better understanding.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="crm_bsp_ic" prefix="crmic" %>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%
data: lv_new type string.
lv_new = 'X'.
DATA: lr_object TYPE REF TO IF_CRM_UI_PROFILE,
rv_result TYPE STRING,
rv_result1 TYPE STRING.
**Here we are checking the Business Role So that it will be applicable only **for our business role i.e. IC_AGENT
lr_object = cl_crm_ui_profile=>get_instance( ).
CALL METHOD lr_object->GET_PROFILE
RECEIVING
RV_RESULT = rv_result.
if RV_RESULT eq 'IC_AGENT'.
Data: lr_gdc TYPE REF TO if_crm_ui_data_context,
lr_bo_prop TYPE REF TO cl_crm_bol_entity,
lr_menu TYPE CRMT_THTMLB_MENU_ITEM,
ls_menu LIKE LINE OF lr_menu.
lr_gdc = cl_crm_ui_data_context_srv=>get_instance( ).
CHECK lr_gdc IS BOUND.
lr_bo_prop ?= lr_gdc->get_entity( name = 'CURRENTCUSTOMER' ).
***Here we are checking whether account is confirmed or not in UI
if lr_bo_prop is INITIAL.
lr_menu[] = controller->menu_items[].
refresh: controller->menu_items.
***Delete the entry from the table with ID ‘IC_BT_INR’ Interaction Record
delete lr_menu where ID eq ‘IC_BT_INR'.
controller->menu_items[] = lr_menu[].
else.
lr_menu[] = controller->menu_items[].
refresh: controller->menu_items.
read TABLE lr_menu INTO ls_menu with key link_id = 'IC_BT_INR'.
if sy-subrc ne 0.
***Adding the Interaction Record Entry back to table which we have copied in ***step 1
ls_menu-item_level = '0000'.
ls_menu-ID = 'IC_BT_INR'.
ls_menu-text = 'Interaction Record'.
ls_menu-link_id = 'IC_BT_INR'.
ls_menu-tooltip = 'Interaction Record'.
APPEND ls_menu TO lr_menu.
controller->menu_items[] = lr_menu[].
ELSE.
controller->menu_items[] = lr_menu[].
endif .
ENDIF.
ENDIF.
if lv_new is initial.
%>
<thtmlb:menu menuItems="<%= controller->menu_items %>" />
<%
else.
%>
<thtmlb:menuII id = "mainmenu"
menuItems = "<%= controller->menu_items %>" />
<%
endif.
%>
Hope it helps .
Thanks
Kumar Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |