AnsweredAssumed Answered

Update task property using calculated value when workflow started

Question asked by softbless on Aug 30, 2013
I have some auto computed values in workflow.

This value is calculated after workflow starts successfully.

But I want to put this Auto computed property as a start task property after workflow how to do it ?

After a lot of searches I found what to do if you want to update task property in Activiti.

There is a class called ActivitiWorkflowEngine.java where method is available to update a task.

I copy paste the code here what they are doing.

But in that code written :
// Known limitation, start-tasks cannot be updated

Is it correct? Could someone help me to achieve the thing that I need?


/**
    * {@inheritDoc}
    */
    public WorkflowTask updateTask(String taskId, Map<QName, Serializable> properties, Map<QName, List<NodeRef>> add,
                Map<QName, List<NodeRef>> remove)
    {
        try
        {
            if(taskId.startsWith(ActivitiConstants.START_TASK_PREFIX))
            {
                // Known limitation, start-tasks cannot be updated
                String msg = messageService.getMessage(ERR_UPDATE_START_TASK, taskId);
                throw new WorkflowException(msg);
            }
           
            Task task = taskService.createTaskQuery().taskId(createLocalId(taskId)).singleResult();
            if(task != null)
            {
                Task updatedTask = propertyConverter.updateTask(task, properties, add, remove);
                return typeConverter.convert(updatedTask);
            }
            else
            {
                String msg = messageService.getMessage(ERR_UPDATE_TASK_UNEXISTING, taskId);
                throw new WorkflowException(msg);
            }           
        }
        catch(ActivitiException ae)
        {
            String msg = messageService.getMessage(ERR_UPDATE_TASK, taskId);
            throw new WorkflowException(msg, ae);
        }
    }

Outcomes