How to show user and database info on the first form (Pool pageflow)?



what is the easiest way to show contact information, manager information and e-mail of the logged user and database info on the first form (Pool pageflow)?

I read lot of threads on the forum, saw all the Bonita videos, read the documentation, read a lot of workaround, tried 50 variation to get it work on my Bonita Community 6.2.6, Java 7.0.55, win 7 _ 64 bits, but what I get is the error below on the "...engine log" and the first page shows an error "Error while getting the form page list." :

  1. Mai 01, 2014 10:51:01 PM org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl resolveExpressions
  2. SEVERE: Error while communicating with the engine.
  3. org.bonitasoft.console.common.server.utils.BPMEngineException: Error when evaluating expressions on process definition 5333649691513201181
  4. at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnProcessDefinition(
  5. at org.bonitasoft.forms.server.api.impl.FormExpressionsAPIImpl.evaluateProcessExpressions(
  6. at org.bonitasoft.forms.server.api.impl.FormWorkflowAPIImpl.getProcessFieldsValues(
  7. at org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl.resolveExpressions(
  8. at org.bonitasoft.forms.server.api.impl.util.FormFieldValuesUtil.setFormWidgetsValues(
  9. at org.bonitasoft.forms.server.FormsServlet.getFormFirstPage(
  10. at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
  11. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  12. at java.lang.reflect.Method.invoke(Unknown Source)
  13. at
  14. at
  15. at org.bonitasoft.forms.server.FormsServlet.processCall(
  16. at
  17. at
  18. at javax.servlet.http.HttpServlet.service(
  19. at javax.servlet.http.HttpServlet.service(
  20. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
  21. at org.apache.catalina.core.ApplicationFilterChain.doFilter(
  22. at org.bonitasoft.console.common.server.login.filter.NoCacheFilter.doFilter(
  23. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
  24. at org.apache.catalina.core.ApplicationFilterChain.doFilter(
  25. at org.apache.catalina.core.StandardWrapperValve.invoke(
  26. at org.apache.catalina.core.StandardContextValve.invoke(
  27. at org.apache.catalina.core.StandardHostValve.invoke(
  28. at org.apache.catalina.valves.ErrorReportValve.invoke(
  29. at
  30. at org.apache.catalina.core.StandardEngineValve.invoke(
  31. at org.apache.catalina.connector.CoyoteAdapter.service(
  32. at org.apache.coyote.http11.Http11Processor.process(
  33. at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
  34. at$
  35. at Source)
  36. Caused by: org.bonitasoft.engine.expression.ExpressionEvaluationException: org.bonitasoft.engine.expression.exception.SInvalidExpressionException: Declared return type class java.lang.Long is not compatible with evaluated type class java.lang.Integer for expression processInstanceId
  37. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsOnProcessDefinition(
  38. at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
  39. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  40. at java.lang.reflect.Method.invoke(Unknown Source)
  41. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(
  42. at org.bonitasoft.engine.api.impl.ServerAPIImpl.access$000(
  43. at org.bonitasoft.engine.api.impl.ServerAPIImpl$
  44. at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(
  45. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(
  46. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(
  47. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(
  48. at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(
  49. at com.sun.proxy.$Proxy13.evaluateExpressionsOnProcessDefinition(Unknown Source)
  50. at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnProcessDefinition(
  51. ... 31 more
  52. Caused by: org.bonitasoft.engine.expression.exception.SInvalidExpressionException: Declared return type class java.lang.Long is not compatible with evaluated type class java.lang.Integer for expression processInstanceId
  53. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.checkReturnType(
  54. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(
  55. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(
  56. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(
  57. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(
  58. at org.bonitasoft.engine.api.impl.transaction.expression.EvaluateExpressionsDefinitionLevel.execute(
  59. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsDefinitionLevel(
  60. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsOnProcessDefinition(
  61. ... 44 more
  63. Mai 01, 2014 10:51:01 PM org.bonitasoft.forms.server.FormsServlet getFormFirstPage
  64. SEVERE: Error while getting the first page for application Validação em 3 fases--1.0$entry
  65. org.bonitasoft.forms.server.exception.FormNotFoundException: Error while communicating with the engine.
  66. at org.bonitasoft.forms.server.provider.impl.FormServiceProviderImpl.resolveExpressions(
  67. at org.bonitasoft.forms.server.api.impl.util.FormFieldValuesUtil.setFormWidgetsValues(
  68. at org.bonitasoft.forms.server.FormsServlet.getFormFirstPage(
  69. at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
  70. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  71. at java.lang.reflect.Method.invoke(Unknown Source)
  72. at
  73. at
  74. at org.bonitasoft.forms.server.FormsServlet.processCall(
  75. at
  76. at
  77. at javax.servlet.http.HttpServlet.service(
  78. at javax.servlet.http.HttpServlet.service(
  79. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
  80. at org.apache.catalina.core.ApplicationFilterChain.doFilter(
  81. at org.bonitasoft.console.common.server.login.filter.NoCacheFilter.doFilter(
  82. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
  83. at org.apache.catalina.core.ApplicationFilterChain.doFilter(
  84. at org.apache.catalina.core.StandardWrapperValve.invoke(
  85. at org.apache.catalina.core.StandardContextValve.invoke(
  86. at org.apache.catalina.core.StandardHostValve.invoke(
  87. at org.apache.catalina.valves.ErrorReportValve.invoke(
  88. at
  89. at org.apache.catalina.core.StandardEngineValve.invoke(
  90. at org.apache.catalina.connector.CoyoteAdapter.service(
  91. at org.apache.coyote.http11.Http11Processor.process(
  92. at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
  93. at$
  94. at Source)
1 answer



From the trace you gave, we can find the root cause of the form loading failure: "return type class java.lang.Long is not compatible with evaluated type class java.lang.Integer for expression processInstanceId". It seems that you are trying to fit a Long typed value when an Integer typed value is requested as return type in one of your expression which is named processInstanceId.

Two cases here: - In many cases, when you are editing an expression from the expression editor dialog, you can define the returned type of the edited expression. If it is the case here and you want the returned type to be Long, change the return type to Long. - Otherwise you will have to cast your Long value to an Integer if it is reliable.



Submitted by jocafi on Fri, 05/02/2014 - 16:39

Thanks, Pierrick I noticed that, but I tried before to return a Long on a possible solution using a script without sucess.

I noticed that I cannot use the pool data variables in the first form. why ?

In the case above I tried a workaround creating a transient variable on the pool level of type String just to get the username of the process initiator. I could assign this variable to one Text widget on the first form but I get the error above.

If I remove the transient variable it works.

how can I use dynamic data including the Bonita user information to fill the first form?

Thx Joca

Submitted by pierrick.voulet on Fri, 05/02/2014 - 16:47

Hello Jocafi,

I think you are not putting the data variable at the right place. Actually, you should be able to use them in the first form and it is not possible to have transient data on the pool level as you said.


Submitted by jocafi on Fri, 05/02/2014 - 23:32

Yes, you can. See my workarea:

The variables mBanana1 and mBanana2 contains pure text and it works if I use them on the first form. mUsername contains the script below:

  1. return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).firstName + " " + BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).lastName;

Whether I use it or not on the form, the system generates the error above. I have to remove / delete this transient variable in order the system can work again.