<?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 Starting a workflow by webscript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289616#M242746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been practicing with a web script that is supposed to take workflow definition name as a parameter and start a workflow of that definition. Here is my 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 definition,&lt;BR /&gt;name;&lt;BR /&gt;&lt;BR /&gt;if (url.templateArgs['name'] === null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; status.code = 400;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; status.message = "A name must be provided.";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; status.redirect = true;&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; name = url.templateArgs['name'];&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;definition = workflow.getDefinitionByName(name);&lt;BR /&gt;definition.startWorkflow(new Array());&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm don't want to set any properties or package items at this point. All I want is to start a workflow but I get an error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;blockquote&amp;gt;"org.springframework.extensions.webscripts.WebScriptException - 00290014 Wrapped Exception (with status template): 00290080 Failed to execute script '\/startWorkflow.get.js (in repository store workspace:\/\/SpacesStore\/Company Home\/Data Dictionary\/Web Scripts Extensions)': null",&amp;lt;/blockquote&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when I'm calling the webscript. I debugged the java code behind this and I can see the null pointer error occurs at this point (method public JscriptWorkflowPath startWorkflow(ScriptNode workflowPackage, Object properties) at class: JscriptWorkflowDefinition):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Serializable context = workflowParameters.get(WorkflowModel.PROP_CONTEXT);&lt;BR /&gt;if (context == null)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; workflowParameters.put(WorkflowModel.PROP_CONTEXT, workflowPackage.getNodeRef());&lt;BR /&gt;}&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;workflowPackage is null. It's supposed to be null because I am not passing any documents. To get rid of this problem context should not be null. So I should set context as a property. The problem is I don't have any idea what is this context supposed to be. Could anyone help how to figure out what the context is supposed to be for me or some other way to solve the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2015 13:22:12 GMT</pubDate>
    <dc:creator>sihnu</dc:creator>
    <dc:date>2015-01-29T13:22:12Z</dc:date>
    <item>
      <title>Starting a workflow by webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289616#M242746</link>
      <description>Greetings,I've been practicing with a web script that is supposed to take workflow definition name as a parameter and start a workflow of that definition. Here is my code:var definition,name;if (url.templateArgs['name'] === null) {&amp;nbsp;&amp;nbsp; status.code = 400;&amp;nbsp;&amp;nbsp; status.message = "A name must be provided.";&amp;nbsp;</description>
      <pubDate>Thu, 29 Jan 2015 13:22:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289616#M242746</guid>
      <dc:creator>sihnu</dc:creator>
      <dc:date>2015-01-29T13:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a workflow by webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289617#M242747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think that's mandatory to pass a workflowPackage. In your case, this workflowPackage, which is a folder, won't have any children.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 10:09:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289617#M242747</guid>
      <dc:creator>mlagneaux</dc:creator>
      <dc:date>2015-01-30T10:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a workflow by webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289618#M242748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply, I think I have confused workflowPackage with itemPackage… What is workflowPackage? When you start workflow using Share user interface you don't usually bind any folders to it. I'm kind a clueless what I should pass there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 13:25:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289618#M242748</guid>
      <dc:creator>sihnu</dc:creator>
      <dc:date>2015-01-30T13:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a workflow by webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289619#M242749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did some googling about workflow package and I got now better understanding of it. So I updated my javascript with this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;…&lt;BR /&gt;definition = workflow.getDefinitionByName(name);&lt;BR /&gt;var workflowPackage = workflow.createPackage();&lt;BR /&gt;definition.startWorkflow(workflowPackage, new Array());&lt;BR /&gt;…&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And it works now. Thanks for the help. It lead me to solve the problem &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 13:37:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/starting-a-workflow-by-webscript/m-p/289619#M242749</guid>
      <dc:creator>sihnu</dc:creator>
      <dc:date>2015-01-30T13:37:06Z</dc:date>
    </item>
  </channel>
</rss>

