cancel
Showing results for 
Search instead for 
Did you mean: 

expression is not working in formkey

accipiter
Champ in-the-making
Champ in-the-making
<userTask id="managerApproval" name="manager approval" activiti:assignee="${manager}" activiti:formKey="managerApproval.jsp?manager=${manager}"></userTask>

manager is a  process variable. it works fine as an expression in assignee, but doesn't work for the formKey

as the description of ACT-1015, formkey support expression from version 5.9 and i m working base on version 5.14
is there anything wrong with what i m doing?

6 REPLIES 6

accipiter
Champ in-the-making
Champ in-the-making
this is the bpmn definition

<userTask id="managerApproval" name="manager approval" activiti:assignee="${manager}" activiti:formKey="managerApproval.jsp?manager=${manager}"></userTask>

manager is a process variable. it works fine as an expression in assignee, but doesn't work for the formKey. it is treated as plain text in formkey

as the description of ACT-1015, formkey support expression from version 5.9 and i m working base on version 5.14
is there anything wrong with what i m doing?

jbarrez
Star Contributor
Star Contributor
I checked the code and it gets resolved. We have unit tests for it.

How are you using this process and how are you fetching this form key?

accipiter
Champ in-the-making
Champ in-the-making
this is the code i am using to get the formkey.

            String formKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());

it give me the value of "managerApproval.jsp?manager=${manager}" with the ${manager} unchanged.

something else, if i dont define the process variable of manager, it will throw an exception here.
so i think something is done here with expression, but it doesn't translate the value for me.

accipiter
Champ in-the-making
Champ in-the-making
i have found the problem. i am using a difination method, however i should use a runtime method.

jbarrez
Star Contributor
Star Contributor
Can you explain that?

accipiter
Champ in-the-making
Champ in-the-making
the process variables are only available in a process instance.
i m trying to get the formkey from process defination at before, therefore i get a unexprected result.
however if i get the formkey from the runtime instance, the process variables are available to fill the expression

String formKey = formService.getTaskFormData(task.getId()).getFormKey();