Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8944

Re: Default the ROLE based on account type

$
0
0

Hello Shiva,

 

You can enhance the event EH_ONSAVE of the component BP_HEAD, View BP_HEAD/BPHEADOverview.

 

You can maintain a z table with the account type and the default role, and then, validate the account type and use this piece of code (this is an example for the role "Prospect":

 

DATA:

 

       lr_header TYPE REF TO if_bol_bo_property_access,

        lr_entity TYPE REF TO cl_crm_bol_entity,

        lr_boprol TYPE REF TO if_bol_entity_col,

        lr_core_tmp           TYPE REF TO cl_crm_bol_core.

 

    lr_header  ?= me->ztyped_context->builheader->collection_wrapper->get_current( ).

     IF lr_header IS BOUND.

       lr_entity ?= lr_header.

       lr_boprol ?= lr_entity->get_related_entities( iv_relation_name = 'BuilRolesRel').

       IF lr_boprol IS BOUND.

         CALL METHOD cl_crm_uiu_bp_tools=>add_role

           EXPORTING

             ir_header       = lr_entity

             iv_rolecategory = 'BUP002'..

 

         lr_core_tmp = cl_crm_bol_core=>get_instance( ).

         lr_core_tmp->modify( ).

       ENDIF.

     ENDIF.


 

And finally invoke the super eh_onsave.


call method super->eh_onsave

     exporting

       htmlb_event    = htmlb_event

       htmlb_event_ex = htmlb_event_ex

     importing

       ev_success     = ev_success.



Best regards,


Renzo.


Viewing all articles
Browse latest Browse all 8944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>