Script error when in Action Group menu
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2008 11:44 AM
I have a script that works when run from the document properties "Run Action"…execute a script…
I added the script to the menu that appears when you are browsing a document in a space (document_browse_menu). When run the script from there I get an error that "document" is not defined.
Here is the script:
Here is the excerpt from web-client-config-custom.xml
Here is the error:
I added the script to the menu that appears when you are browsing a document in a space (document_browse_menu). When run the script from there I get an error that "document" is not defined.
Here is the script:
var createVersion = "true";var space = document.parent;var tempFolder = companyhome;var fileName = document.properties.name;var parentFolderParent=space.parent;var destFolder = parentFolderParent.childByNamePath("Approved");var destFile = destFolder.childByNamePath(fileName);// Check for existing PDFif (destFile==null){ var success = document.move(destFolder); createVersion="false";}else if (!destFile.hasAspect("cm:versionable")){ destFile.addAspect("cm:versionable");}if (createVersion=="true"){ var updatedVersion = document.copy(tempFolder); var workingCopy = destFile.checkout(); workingCopy.properties.content.write(updatedVersion.properties.content); workingCopy.checkin(); updatedVersion.remove(); document.remove();}
Here is the excerpt from web-client-config-custom.xml
<config evaluator="node-type" condition="rg:approvableType"> <actions> <action id="NB_approve_action"> <permissions> <permission allow="true">Write</permission> </permissions> <label>NBApprove Action</label> <image>/images/icons/approve.gif</image> <script>/Company Home/Data Dictionary/Scripts/ApproveDoc.js</script> <params> <param name="noderef">#{actionContext.nodeRef}</param> </params> </action> <action-group id="document_browse_menu"> <action idref="preview_doc" hide="true" /> <action idref="update_doc" hide="true" /> <action idref="cancelcheckout_doc" hide="true" /> <action idref="approve_doc" hide="true" /> <action idref="reject_doc" hide="true" /> <action idref="cut_node" hide="false" /> <action idref="copy_node" hide="false" /> <action idref="start_workflow" hide="true" /> <action idref="NB_approve_action" /> </action-group> </actions> </config>
Here is the error:
org.alfresco.error.AlfrescoRuntimeException: Error during command servlet processing: Failed to execute script 'workspace://SpacesStore/3c5111ae-63e1-11dd-9e28-53b14ffe9004': Failed to execute script 'workspace://SpacesStore/3c5111ae-63e1-11dd-9e28-53b14ffe9004': ReferenceError: "document" is not defined. (AlfrescoScript#2)caused by:org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'workspace://SpacesStore/3c5111ae-63e1-11dd-9e28-53b14ffe9004': Failed to execute script 'workspace://SpacesStore/3c5111ae-63e1-11dd-9e28-53b14ffe9004': ReferenceError: "document" is not defined. (AlfrescoScript#2)
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2009 02:33 AM
did you ever find a solution to this problem?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2009 08:33 AM
This post works
http://forums.alfresco.com/en/viewtopic.php?f=3&t=8435&hilit=actionContext+nodeRef
