Error Start workflow via JavaScript

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2010 03:54 PM
I can't get start a Workflow via Web Script.
I created the file workflow.get.js:
workflow.get.desc.xml
when I click http://localhost:8080/alfresco/service/workflow?nodeId=fdadc86f-d996-472d-8267-850a63573b02&w=jbpm$w... return the error
Anybody help me?
I created the file workflow.get.js:
var nodeId = args.nodeid; //fdadc86f-d996-472d-8267-850a63573b02var workflowName = args.w; //jbpm$wf:adhocvar document = search.findNode("workspace://SpacesStore/" + nodeId); var workflowAction = actions.create("start-workflow"); workflowAction.parameters.workflowName = workflowName; workflowAction.parameters["bpm:workflowDescription"] = "Please edit: " + document.name; workflowAction.parameters["bpm:assignees"] = [people.getPerson("admin"), people.getPerson("admin")];var futureDate = new Date(); futureDate.setDate(futureDate.getDate() + 7); workflowAction.parameters["bpm:workflowDueDate"] = futureDate; workflowAction.execute(document);
workflow.get.desc.xml
<webscript> <shortname>Start Workflow</shortname> <description>Testando Start Workflow</description> <url>/workflow?nodeid={idfile}&&w={namewf}</url> <format default="html">argument</format> <authentication>admin</authentication> <transaction>required</transaction></webscript>
and workflow.get.html.ftlThe ${args.w} started!
when I click http://localhost:8080/alfresco/service/workflow?nodeId=fdadc86f-d996-472d-8267-850a63573b02&w=jbpm$w... return the error
Exception: org.alfresco.error.AlfrescoRuntimeException - 08200041 TypeError: Cannot read property "name" from null (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/Workflow/workflow.get.js#7) org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:469) Exception: org.alfresco.scripts.ScriptException - 08200042 Failed to execute script '/Workflow/workflow.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': 08200041 TypeError: Cannot read property "name" from null (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/Workflow/workflow.get.js#7) org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:183) Exception: org.springframework.extensions.webscripts.WebScriptException - 08200035 Wrapped Exception (with status template):08200042 Failed to execute script '/Workflow/workflow.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': 08200041 TypeError: Cannot read property "name" from null (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/Workflow/workflow.get.js#7) org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)
Anybody help me?
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2010 07:16 PM
Hi,
So from the error presented it looks like the node reference you are searching for does not exist.
Perhaps you could use the Node Browser in the Explorer client to double check that node reference being passes exists?
Cheers,
Roy
ScriptNode findNode(string noderef) Returns a single ScriptNode as specified by the string form of the NodeRef for that node, null is returned if the search failed.
So from the error presented it looks like the node reference you are searching for does not exist.
Perhaps you could use the Node Browser in the Explorer client to double check that node reference being passes exists?
Cheers,
Roy
