cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]Take Ownership of a Pooled Task in Webscript/Java

hyperation
Champ on-the-rise
Champ on-the-rise
Hi,

I am trying to figure out how to create a webscript or java-backed webscript that can allow me to take ownership of a workflow pooled task.

I've tried directly changing the "owner" property of the task, but it doesn't seem to be working.

Attempted:


var task = workflow.getTaskById(args['taskId']);  // taskId is the PooledTask's id, jbpm$###.
logger.log(task.getId());  // shows the id properly

logger.log("TASK PROP: " + task.properties['cm:owner']); // this property doesn't seem to exist.
logger.log("TASK PROP: " + task.properties['{http://www.alfresco.org/model/content/1.0}owner']);  // this property doesn't seem to exist.

var props = task.getProperties() // This function I got from the wiki doesn't return anything, it returned null.


Any help is appreciated.

Thanks
Smiley Happy
4 REPLIES 4

hyperation
Champ on-the-rise
Champ on-the-rise
Hi,

For those we are having the same problem.  I was able to find an alternative way using Java-backed Webscripts.

Using the WorkflowService:


Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(ContentModel.PROP_OWNER, owner);
WorkflowTask updatedTask = workflowService.updateTask(taskId, params, null, null);   

Thanks
Smiley Happy

eferreira
Champ in-the-making
Champ in-the-making
Hi,

Did you managed it ? It's possible to you to give me some more hints how to do that ?

I'm a little bit lost…not know if it's better to do a Java Class or just create  a webscript to do that….

Thanks in advanced.

Eduardo

hyperation
Champ on-the-rise
Champ on-the-rise
Hi,

I'm not sure how this is done in Javascript webscript, but the if you write it as a Java-backed webscript you can use the WorkflowService to update the task owner (the code is provided on my previous post.).

Thanks
Smiley Happy

raptus
Champ in-the-making
Champ in-the-making
Hello,
could you post the entire java code??
I found no examples….

Thanks,
Raptus