cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Script Variable/Object

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

I am trying to find out what methods or properties are available for each workflow objects/variables:

For instance, in the Workflow Administration wiki, the taskInstance variable have properties like:

taskInstance.id
taskInstance.description
taskInstance.dueDate
etc.

But, I also want to know what available methods are there??  I read some articles and I see methods like setVariable, getVariable… is there any more?

Where can I get a list of all the properties and methods defined in that variable/object?

Thanks
:0
5 REPLIES 5

stevegreenbaum
Champ in-the-making
Champ in-the-making
Try this link and see if this what you were looking for -

http://wiki.alfresco.com/wiki/JavaScript_API

groberts
Champ on-the-rise
Champ on-the-rise
I know *exactly* what you mean, I'm trying to write some web scripts that use the work flow api and need to find a way to interrogate JS objects to reveal what they can do so that I can marshall the JSON response.   I'm more used to Java than loosely typed JS.  There must be a productive way to find out what data structures are being returned.

At the moment I' trying to work out how to use the return value of JscriptWorkflowTask getProperties() which returns a ScriptableQNameMap<String Serializable>.

It'll be obvious when I find it !

hyperation
Champ on-the-rise
Champ on-the-rise
Try this link and see if this what you were looking for -

http://wiki.alfresco.com/wiki/JavaScript_API


Thanks, but I've already went through the JavaScript API and it didn't have much information.

Thanks
Smiley Happy

hyperation
Champ on-the-rise
Champ on-the-rise
Update on this topic:

While i was working with Workflow tasks and transitions, I found out that it is "impossible" to get a task's transition in Webscript.

for instance:

var task = workflow.getTask("jbpm$001");  //returns the task.
logger.log(task.getTransitions());  // returns null.
logger.log(task.transitions); // null property.
BUT, when this is done in FreeMarker it works fine.

<#list workflow.assignedTasks as task>
    <#list task.transitions as trans>
       ${trans.id)


So, does anyone know what's the deal here?

Thanks
Smiley Happy

groberts
Champ on-the-rise
Champ on-the-rise
Not sure about your most recent issue,  but I think I've solved my problem.   From the

http://localhost:8080/alfresco/service/index page I eventually looked at some of the other workflow Web Scripts including

My Tasks (Office Add-In)
GET /alfresco/service/office/myTasks?p={path}

Generate the Office Add-In My Tasks page

Authentication:   user
Transaction:   required
Format Style:   any
Default Format:   html
Id:   org/alfresco/office/myTasks.get
Descriptor:   classpath:alfresco/templates/webscripts/org/alfresco/office/myTasks.get.desc.xml
In the source code myTasksDetail.get.xml.ftl and myTasks.get.html.ftl there is a lot of detail about fetching workflow status.

Also lots of property names.

Macintosh:office Guy$ grep bpm *
docActions.get.js:               workflow.parameters["bpm:workflowDescription"] = description;
docActions.get.js:               workflow.parameters["bpm:assignee"] = assignTo;
docActions.get.js:                  workflow.parameters["bpm:workflowDueDate"] = dueDate;
myAlfresco.get.html.ftl:   <#assign hasDue=t.properties["bpm:dueDate"]??>
myAlfresco.get.html.ftl:      <#assign due=t.properties["bpm:dueDate"]>
myAlfresco.get.xml.ftl:   <#assign hasDue=t.properties["bpm:dueDate"]??>
myAlfresco.get.xml.ftl:      <#assign due=t.properties["bpm:dueDate"]>
myTasks.get.html.ftl:   <#assign hasDue=t.properties["bpm:dueDate"]??>
myTasksDetail.get.html.ftl:                  <td>${task.properties["bpm:status"]}</td>
myTasksDetail.get.html.ftl:                  <td>${task.properties["bpm:priority"]}</td>
myTasksDetail.get.html.ftl:                  <td>${task.properties["bpm:percentComplete"]}%</td>
myTasksDetail.get.xml.ftl:                  <status>${task.properties["bpm:status"]}</status>
myTasksDetail.get.xml.ftl:                  <priority>${task.properties["bpm:priority"]}</priority>
myTasksDetail.get.xml.ftl:              <complete>${task.properties["bpm:percentComplete"]}%</complete>
Best regards,

G.