cancel
Showing results for 
Search instead for 
Did you mean: 

[CRM WebUI] How to get index of selected entry from a dropdown field?

iamjaredm021
Participant
0 Kudos

Hello Experts,

Currently, we are having an issue where one order item is being forwarded to incorrect organization as it is always being forwarded to receiving agent's first assigned organization in cases he is assigned to multiple organizations (as shown below). For this to be resolved, we have to determine the index of selected entry from the dropdown field. Please advise how this can be done.

The dropdown field (ForwardTo) is defined in the view above as follows:

It is being populated through IF_EX_CRM_IC_INBOX_BADI~POSSIBLE_RECEIVERS.

Thank you.

Regards,

Jay Mercurio

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jay

First of all you will need to add an action handler to your dropdown list box using the attribute onSelect like so inside the InboxItems.htm:

onSelect          = "FORWARDTO_SELECTED"

Then create an action handler by right clicking Event Handler (in the view structure pane) and selecting create and then enter FORWARDTO_SELECTED as the name.

Then let's say you want to use the selected index as a globally accesible variable so create a new attribute in the view controller class called gv_forwardto

Then add the following coding in the action handler method

  DATA: thisevent TYPE REF TO cl_htmlb_event.

  DATA: formfields TYPE tihttpnvp,

        ls_formfields TYPE ihttpnvp.

  DATA: wa_formfields TYPE ihttpnvp.



  CALL METHOD request->get_form_fields

    CHANGING

      fields = formfields.



  LOOP AT formfields INTO wa_formfields.

    IF wa_formfields-name CP '*ifforwardto'.

      me->gv_forwardto = wa_formfields-value.

    ENDIF.

  ENDLOOP.

This event will be triggered every time the user clicks on the dropdown list box and the value of the selection will be stored in the global variable which you can then consume elsewhere.

Cheers

iamjaredm021
Participant
0 Kudos

Thanks Daniel. We'll check this approach and let you once it works.