cancel
Showing results for 
Search instead for 
Did you mean: 

modifying workflow task properties in javascript

r1ch4rd
Champ in-the-making
Champ in-the-making
Hi Folks,

I am trying to introduce a REST web service for controlling workflows using the web scripts framework.  I've found it relatively straightforward to write GET requests which expose the workflow state, but I am having problems controlling the workflow.  There are methods such as [definition].startWorkflow(), which will take some task properties as an argument, but I need to be able to pass in further workflow properties as the process executes.  I have been able to execute the following code with success:

var task = workflow.getTaskByID(taskID);
task.properties["someProperty"] = "someValue";

but this property only persists for the duration of the existance of the javascript task object.  I need to persist this information in Alfresco somehow.  I've looked at the source code for the java objects which back the javascript api, and can't find anything like a commit() or save() method, or see any persistance annotations.  How can I get my properties to persist between requests?

Or am I approaching workflow task model properties in the wrong way?

Any advice gratefully appreciated.

Cheers,

Richard
2 REPLIES 2

risenhoover
Champ in-the-making
Champ in-the-making
Most of the other Javascript types have a save() method on them that you can use to persist the data.  You might just want to try that (if you haven't already).

I'm having a strange problem in that I can't even get a reference to the workflow object.  I get the following exception:

11:30:02,552 INFO  [web.scripts.DeclarativeWebScript] Caught exception & redirecting to status template: Failed to execute script 'workspace://SpacesStore//Co
mpany Home/Data Dictionary/Web Scripts Extensions/d3/tasks/endTask.post.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/W
eb Scripts Extensions/d3/tasks/endTask.post.js': ReferenceError: "workflow" is not defined. (AlfrescoScript#7)

I'm afraid I'm going to find out that this workflow object isn't exposed in 2.2, but only in 3.0.  Can you please share with me the version you are using?

emmy
Champ in-the-making
Champ in-the-making
Hi,
I have the same problem. You have solved?

Thanks,
Emanuela