<?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 help in scripting in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137595#M96443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've put together a simple web script to kick off the predefined "review and approve" workflow but currently getting an error about the document object:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/myworkflow.get.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/myworkflow.get.js': ReferenceError: "document" is not defined. (AlfrescoScript#5) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var workflow = actions.create("start-workflow"); &lt;BR /&gt;workflow.parameters.workflowName = "jbpm$wf:review &amp;amp; approve"; &lt;BR /&gt;workflow.parameters["bpm:workflowDescription"] = "proxy_server.gif"; &lt;BR /&gt;workflow.parameters["bpm:assignee"] = "administrator"; &lt;BR /&gt;workflow.execute(document);&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;proxy_server.gif is a document that is already being uploaded to the system and currently resides on "Company Home" content.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Isn't document is one of the objects available by default in the root scripting scope?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, please advice if there are any other errors found in the script above.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Much Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jan 2008 20:55:54 GMT</pubDate>
    <dc:creator>wps07032</dc:creator>
    <dc:date>2008-01-11T20:55:54Z</dc:date>
    <item>
      <title>help in scripting</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137595#M96443</link>
      <description>Hello,I've put together a simple web script to kick off the predefined "review and approve" workflow but currently getting an error about the document object:Here is the error:Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/myworkflow.g</description>
      <pubDate>Fri, 11 Jan 2008 20:55:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137595#M96443</guid>
      <dc:creator>wps07032</dc:creator>
      <dc:date>2008-01-11T20:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: help in scripting</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137596#M96444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The root objects available to a JS script vary, depending on the context in which that script is executed (custom action vs workflow vs web script etc. etc.).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As documented at &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Web_Scripts#.22Execute.22_Script" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Web_Scripts#.22Execute.22_Script&lt;/A&gt;&lt;SPAN&gt;, the "document" root object is not available to web script JS scripts, which makes sense given that the web script engine has no way of knowing which file in the repository to populate that root object with (ie. it has no way of knowing that you wish it to operate on your proxy_server.gif file in preference to any of the other files that are in your repository).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead you'll have to pass a reference to that file to your web script as a parameter (as a node ref or a repository path, for example).&amp;nbsp; Many of the web scripts included in Alfresco show examples of how to do this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Peter&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2008 22:20:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137596#M96444</guid>
      <dc:creator>pmonks</dc:creator>
      <dc:date>2008-01-11T22:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: help in scripting</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137597#M96445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Peter,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm very new to Alfreso, would you kindly post one example here or point me to the exact location of where the Alfresco examples are.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Much appreciate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2008 19:16:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137597#M96445</guid>
      <dc:creator>wps07032</dc:creator>
      <dc:date>2008-01-25T19:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: help in scripting</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137598#M96446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are a number of example Web Scripts at &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Web_Scripts_Examples" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Web_Scripts_Examples&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; The source code for the Web Scripts bundled with the product is also available, either in the full Alfresco source code (see &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment&lt;/A&gt;&lt;SPAN&gt; for details on obtaining this) or by looking in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;${TOMCAT_HOME}/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;in an Alfresco installation (although note that this second option only contains the source code for Javascript / Freemarker backed Web Scripts - Java backed Web Scripts are compiled into the Alfresco WAR).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2008 20:55:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/help-in-scripting/m-p/137598#M96446</guid>
      <dc:creator>pmonks</dc:creator>
      <dc:date>2008-01-25T20:55:10Z</dc:date>
    </item>
  </channel>
</rss>

