Access NodeRef in Webscript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 03:45 PM
I am attempting to create a custom action that invokes a webscript. The action will be available
on folders.
My action definition in share-config-custom.xml is:
my-action.get.desc.xml
my-action.get.html.ftl
<@processJsonModel group="share"/>
The problem I am having is that I cannot access the nodeRef argument in the Controller my-action.get.js
Any help would be appreciated.
Thanks
The controller, my-action.get.js
on folders.
My action definition in share-config-custom.xml is:
<action id="my-action" type="pagelink" label="My Action" icon="my-action"> <param name="page">hdp/ws/my-action?nodeRef={node.nodeRef}</param> <permissions> <permission allow="true">Write</permission> </permissions> <evaluator>evaluator.doclib.action.isFolder</evaluator></action>
my-action.get.desc.xml
<webscript> <shortname>Custom Action Page</shortname> <description>Custom action description</description> <url>/my=action?nodeRef={noderef}</url> <authentication>user</authentication></webscript>
my-action.get.html.ftl
<@processJsonModel group="share"/>
The problem I am having is that I cannot access the nodeRef argument in the Controller my-action.get.js
Any help would be appreciated.
Thanks
The controller, my-action.get.js
var noderx = args.nodeRef;model.jsonModel = { widgets: [{ id: "SET_PAGE_TITLE", name: "alfresco/header/SetTitle", config: { title: noderx + "-This is a simple page" } }, { id: "MY_HORIZONTAL_WIDGET_LAYOUT", name: "alfresco/layout/HorizontalWidgets", config: { widgetWidth: 50, widgets: [ { name: "alfresco/logo/Logo", config: { logoClasses: "alfresco-logo-only" } }, { name: "example/widgets/TemplateWidget" } ] } }]};
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 03:51 PM
Please post your controller.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 04:38 PM
I have updated the post to include the controller code.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2016 02:46 AM
I dont see any flaw in your code, you should be able to access noderef in your controller. Can you post error logs too!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2016 10:08 AM
I am attaching my catalina.out and a screenshot that shows that the NodeRef variable is getting the
value null.
value null.
myAction.png
53 KB

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2016 01:37 AM
Can you try this to get noderef in your controller ! As you have defined your action as pagetype
var noderx = page.url.args.nodeRef ;
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2016 01:04 PM
That worked! Thanks!!
