Why is the getName() for a task returning the formKey?

cancel
Showing results for 
Search instead for 
Did you mean: 
mangar
Established Member II

Why is the getName() for a task returning the formKey?

I have this declared as my start task for a workflow:

    <startEvent id="StartWriteMessage" name="Start" activiti:formKey="elpwf:startAndAssignUser">
      <extensionElements>
        <activiti:taskListener xsi:type="xsd:anyType" event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field xsi:type="xsd:anyType" name="script">
            <activiti:string xsi:type="xsd:anyType">execution.setVariable('elpwf_assignUser', task.getVariable('elpwf_assignUser'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
      <outgoing>SequenceFlow_1</outgoing>
    </startEvent>

When I start the workflow and use the Alfresco WorkflowService to get the start task instance like this:

WorkflowTask task = workflowService.getStartTask(workflowInstanceId);
String name = task.getName();
logger.debug("task name is:{}",name);

That is printing  "elpwf:startAndAssignUser"  and I am obviously expecting "Start" (The name in the deffinition)  and not the formKey.

What am I doing wrong?

1 Reply
sanjaybandhniya
Intermediate

Re: Why is the getName() for a task returning the formKey?

You should provide label of that formkey.

You have declared that in workflow model so you have to provide name there.