Dropdown list with different displayed / saved values

1
0
-1

On a form, I am using a dropdown list. I would like to set differents values:

  • Displayed values
  • Values that are saved for the process, in function of the selected displayed value

I seems it is not possible out of the box. How can I make it works ?

2 answers

1
+1
-1

Yes, it can be done. You need to use a Map instead of a List as the available values expression of the dropdown. The keys of the map should be the displayed values and the values should be the saved values.

For example : ["label 1":"value1","label 2":"value2"]

1
0
-1

So, I tried to do a simple list and display it on my form, but I got an error. I can't figure it out.

The script I tried:

import groovy.sql.Sql

def result = []

Sql sql = BonitaSql.newInstance("jdbc:oracle:thin:@MY_IP:1521:DATABASE", "USER", "PASSWORD",new oracle.jdbc.OracleDriver())

sql.eachRow 'select * from TABLE', { result += it.COLUMN }

sql.close()

result

The test runs just fine and returns the values like [test1,test2,test3] but when I try to run the form it doesn't load. I got the error from the bonita's log (posting just the first lines):

Out 30, 2013 9:22:33 AM org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl resolveExpressions
SEVERE: Error while communicating with the engine.
org.bonitasoft.forms.server.exception.BPMEngineException: Error when evaluating expressions on activity instance 12
at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnActivityInstance(ExpressionEvaluatorEngineClient.java:44)

Any directions?

Notifications