<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Workflow execute needs nodeRef? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228060#M181190</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to start my custom workflow from JavaScript with the code below.&amp;nbsp; I get the error that the workflowAction.execute() requires a nodeRef.&amp;nbsp; I've tried passing the document object as well as document.nodeRef, but neither seems to satisfy it.&amp;nbsp; I've walked through the script in the debugger and everything seems to be correct up to the execute.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The web script call looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;A href="http://localhost:8080/alfresco/wcs/test/startWorkflow?nodeid=d8d0a561-093d-4492-a124-9fb63369fae2" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/wcs/test/startWorkflow?nodeid=d8d0a561-093d-4492-a124-9fb63369fae2&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;The log shows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Executing script /test/startWorkflow.get.js (in classpath store file:C:/Alfresco/tomcat/shared/classes/alfresco/extension/templates/webscripts)&lt;BR /&gt;&lt;BR /&gt;nodeId = d8d0a561-093d-4492-a124-9fb63369fae2&lt;BR /&gt;&lt;BR /&gt;theDocument = Node Type: {&lt;A href="http://www.alfresco.org/model/content/1.0}content" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}content&lt;/A&gt;, Node Aspects: [{&lt;A href="http://www.alfresco.org/model/content/1.0}auditable" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}auditable&lt;/A&gt;, {&lt;A href="http://www.alfresco.org/model/system/1.0}referenceable" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/system/1.0}referenceable&lt;/A&gt;, {&lt;A href="http://www.alfresco.org/model/application/1.0}inlineeditable" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/application/1.0}inlineeditable&lt;/A&gt;, {&lt;A href="http://www.alfresco.org/model/content/1.0}titled" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}titled&lt;/A&gt;, {&lt;A href="http://www.alfresco.org/model/content/1.0}author" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}author&lt;/A&gt;]&lt;BR /&gt;&lt;BR /&gt;theDocument nodeRef = workspace:/ /SpacesStore/d8d0a561-093d-4492-a124-9fb63369fae2&lt;BR /&gt;&lt;BR /&gt;Attached JBPM Context to transaction 4d7d09fc-2917-407c-8373-157e14646314&lt;BR /&gt;&lt;BR /&gt;Caught exception; decorating with appropriate status template : org.alfresco.scripts.ScriptException: 04170028 Failed to execute script '/test/startWorkflow.get.js (in classpath store file:C:/Alfresco/tomcat/shared/classes/alfresco/extension/templates/webscripts)': NodeRef must be supplied.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone tell me what is wrong with this code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var nodeId = args.nodeid;&lt;BR /&gt;&lt;BR /&gt;logger.log("nodeId = " + nodeId);&lt;BR /&gt;&lt;BR /&gt;// var document = utils.getNodeFromString("workspace://SpacesStore/" + nodeId);&lt;BR /&gt;var theDocument = search.findNode("workspace://SpacesStore/" + nodeId);&lt;BR /&gt;&lt;BR /&gt;logger.log("theDocument = " + theDocument);&lt;BR /&gt;logger.log("theDocument nodeRef = " + theDocument.nodeRef);&lt;BR /&gt;&lt;BR /&gt;var workflowAction = actions.create("start-workflow");&lt;BR /&gt;workflowAction.parameters.workflowName = "jbpm$nmwf:MyWorkflow";&lt;BR /&gt;workflowAction.parameters["bpm:workflowDescription"] = "Please edit: " + theDocument.name;&lt;BR /&gt;workflowAction.parameters["bpm:assignees"] = [people.getPerson("admin"), people.getPerson("joebloe")];&lt;BR /&gt;var futureDate = new Date();&lt;BR /&gt;futureDate.setDate(futureDate.getDate() + 7);&lt;BR /&gt;workflowAction.parameters["bpm:workflowDueDate"] = futureDate;&lt;BR /&gt;workflowAction.parameters["bpm:dueDate"] = futureDate;&lt;BR /&gt;// workflowAction.execute(theDocument);&lt;BR /&gt;workflowAction.execute(theDocument.nodeRef);&lt;BR /&gt;workflowAction.signal();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 May 2010 05:26:28 GMT</pubDate>
    <dc:creator>sgartner</dc:creator>
    <dc:date>2010-05-18T05:26:28Z</dc:date>
    <item>
      <title>Workflow execute needs nodeRef?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228060#M181190</link>
      <description>I'm trying to start my custom workflow from JavaScript with the code below.&amp;nbsp; I get the error that the workflowAction.execute() requires a nodeRef.&amp;nbsp; I've tried passing the document object as well as document.nodeRef, but neither seems to satisfy it.&amp;nbsp; I've walked through the script in the debugger and</description>
      <pubDate>Tue, 18 May 2010 05:26:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228060#M181190</guid>
      <dc:creator>sgartner</dc:creator>
      <dc:date>2010-05-18T05:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow execute needs nodeRef?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228061#M181191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would still like to know why the previous (Alfresco specific) code doesn't work (so I'm not going to mark it solved yet), but it turns out doing it the long way works just fine (in theory this is what the action used above is doing):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var nodeId = args.nodeid;&lt;BR /&gt;var theDocument = search.findNode("workspace://SpacesStore/" + nodeId);&lt;BR /&gt;&lt;BR /&gt;var workflowDefinition = workflow.getDefinitionByName("jbpm$nmwf:myWorkflow");&lt;BR /&gt;&lt;BR /&gt;var workflowPackage = workflow.createPackage();&lt;BR /&gt;workflowPackage.addNode(theDocument);&lt;BR /&gt;&lt;BR /&gt;var workflowParameters = [];&lt;BR /&gt;workflowParameters["bpm:workflowDescription"] = "Please edit: " + theDocument.name;&lt;BR /&gt;workflowParameters["bpm:assignees"] = [people.getPerson("admin"), people.getPerson("joebloe")];&lt;BR /&gt;var futureDate = new Date();&lt;BR /&gt;futureDate.setDate(futureDate.getDate() + 7);&lt;BR /&gt;workflowParameters["bpm:workflowDueDate"] = futureDate;&lt;BR /&gt;workflowParameters["bpm:dueDate"] = futureDate;&lt;BR /&gt;workflowParameters["bpm:workflowPriority"] = 1;&lt;BR /&gt;&lt;BR /&gt;var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);&lt;BR /&gt;&lt;BR /&gt;// This does *not* work, I get "bpm_assignees is not defined"&lt;BR /&gt;// workflowPath.signal(null); &lt;BR /&gt;&lt;BR /&gt;// End the start task&lt;BR /&gt;var tasks = workflowPath.getTasks();&lt;BR /&gt;for (task in tasks)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; tasks[task].endTask(null);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 May 2010 03:33:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228061#M181191</guid>
      <dc:creator>sgartner</dc:creator>
      <dc:date>2010-05-19T03:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow execute needs nodeRef?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228062#M181192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a little up to know if someone has make progress on this problem ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 12:17:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228062#M181192</guid>
      <dc:creator>jc09</dc:creator>
      <dc:date>2011-09-21T12:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow execute needs nodeRef?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228063#M181193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Just a little up to know if someone has make progress on this problem ?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I never learned anything more about this problem.&amp;nbsp; We are still using the code I posted last.&amp;nbsp; If you find anything, please do update this thread.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 19:17:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/workflow-execute-needs-noderef/m-p/228063#M181193</guid>
      <dc:creator>sgartner</dc:creator>
      <dc:date>2011-09-21T19:17:29Z</dc:date>
    </item>
  </channel>
</rss>

