cancel
Showing results for 
Search instead for 
Did you mean: 

Expression to custom form field

jwistrom
Champ in-the-making
Champ in-the-making
Hi
I have been wrestling with this problem for a while and I really hope someone could assist me with this. I am fairly new to Activiti so I will try to describe as detailed as possible what I am looking for and what I have tried.

I have created my first custom form field (I am not using activiti explorer) and a corresponding form type. The field consists of two tables with drag and drop functionality. I have created the form type so it accepts two values, like this


<activiti:formProperty expression="${formDataService.getUsers(tenantid)}" id="role_consultants" name="Chose consultants (C)" type="doubleTable">
          <activiti:value id="leftTableCaption" name="Available users"/>
          <activiti:value id="rightTableCaption" name="Assigned as consultants"/>
        </activiti:formProperty>


This works great…almost. The form is rendered with my custom field and two tables are shown with corresponding captions (as in code). I can pass in the expression with all the users (that end up in the "available users"-table). This is a recurring task so when I open the task again I want the users I draged to the "assigned as consultants"-table the first time (i.e. the users in the variable role_consultants) to show in that table when I open the task the second time. The users are stored in the variable correctly but I can't pass it in. I can only pass in the expression. My idea was something like this:


<activiti:formProperty  id="role_consultants" name="Chose consultants (C)" type="doubleTable">
          <activiti:value id="leftTableCaption" name="Available users"/>
          <activiti:value id="rightTableCaption" name="Assigned as consultants"/>
          <activiti:value id="availableUsers" name="${formDataService.getUsers(tenantid)}"/>
        </activiti:formProperty>


i.e. pass in the expression with available users as an additional value but I noticed that activiti:value does not support expressions. The only thing that is passed in is the actual string "${formDataService.getUsers(tenantid)}" and that does me no good Smiley Happy
So, can I evaluate this string that is passed in as an expression in the form type or can I solve this problem another way?

Very greatful for any help.

Rgds
Johan
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi Johan,

Is there a reason why you want to use form properties? To me it sounds like you are better of with some custom logic that gets variables from the process context. Then you can get the variable value and present it to the user like you are describing.

Best regards,

jwistrom
Champ in-the-making
Champ in-the-making
Do you mean using a custom form with form key? I have considered that but I guess using form properties would allow me to better reuse the component. But if this is not possible with form property I might have to go with a form key. I just wanted to see if this could be solved using form properties

jbarrez
Star Contributor
Star Contributor
We ourselves are going away from the form properties approach. In the commercial version of Activiti, and in Activiti 6, the formKey approach is used (form properties are still there, but not used)