Calling javascript from a DocLib action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2017 08:56 AM
Dear All,
Managed to create a script which is executed on a folder level. Basically, the script takes the custom properties of the selected folder and updates all the child objects with the property values.
Currently the use is obliged to use the Run Action DocLib action and select the right JS file. I would like to simplify this to create a DocLib action displayed in folder-details and folder-browe views.
Added the following code to the share-config-custom.xml
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="updatedocuments" type="javascript" label="Update" icon="folder-move-to">
<param name="function">onActionUpdateDocuments</param>
</action>
</actions>
<actionGroups>
<actionGroup id="folder-browse">
<action index="500" id="updatedocuments" />
</actionGroup>
<actionGroup id="folder-details">
<action index="500" id="updatedocuments" />
</actionGroup>
</actionGroups>
</config>
- Do I have to copy the JS file into the \tomcat\webapps\share\js folder?
- How can I tell to the action definiton to which JS file it should talk to?
Thanks alot for your help,
Zsolt Putnoky
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 03:41 AM
!! SOLVED !!
Dear All,
We solved the above question by following the discussion in the following thread:
https://community.alfresco.com/thread/205795-custom-action-using-server-side-javascript
- You need to modify the share-custom-config.xml file to include the menu item
- create and save the JS file into ./tomcat/shared/classes/alfresco/extension/scripts folder
- create and save a context file into ./tomcat/shared/classes/alfresco/extension/ folder
- find and save a 16x16 PNG icon for your new action into ./tomcat/webapps/share/components/documentlibrary/actions
Zsolt Putnoky
