0

In my application have a single select which displays "items from service" the output of the service is list of name-value pair and the binding of the single select is also name-value pair object, but when I am trying to read the selected name and value in my code using getSelectedItem() or by directly accessing the binding I always get the code, not the value.

I debugged it a lot and found that everything is fine still the binding is coming as string only not name value pair object. Does anyone have an idea about this issue?

Thanks!


My BPM version is - 8.6.0.0

Build Level        :   20170918-081825
Build Date         :   9/18/17
Package            :   com.ibm.bpm.ADV.v85_8.6.0.20170918_1207
Architecture       :   x86-64 (64 bit)
Shabeer K
  • 1,489
  • 16
  • 23
Rahul
  • 269
  • 2
  • 10
  • 25
  • I remember having problems with this as well with SparkUI - we moved to apex controls, which are easier to control. Try Using a Multi-Select control https://salientprocess.zendesk.com/hc/en-us/articles/206631777-Multi-Select and use getData() – Nils May 29 '19 at 14:17

2 Answers2

0

Assuming you single select is named "selectCV" to get keys and its value you need to call it this way:

var key = selectCV.getSelectedItem();
var value = selectCV.getItemText(key);

Reason for that is difference in terminology BPMUI (previously SPARK UI) uses for keys and values of dropdown. Underlying key is called "value property" while what value that user sees is called "display property", you can see it in configuration options. Documentation saying that "getSelectedItem" returns "value associated with item selected" really means it returns underlying key. This is why you need to get "display" text for key to get a value you are looking for.

See also pre-IBM docs for Single Select, especially for "getItemText" here: https://support.salientprocess.com/docs/enterprise/SingleSelect.html#getItemText

andy
  • 757
  • 5
  • 13
0

As you are saying you have bind NameValuePair to that Single Select and returning NameValuePair from service then I would suggest instead of using getSelectedItem() you can use getData().name or getData().value whatever you want. I hope this will solve your problem.

Yogesh Raut
  • 5
  • 1
  • 6