cancel
Showing results for 
Search instead for 
Did you mean: 

Access NodeRef in Webscript

art99trash
Star Contributor
Star Contributor
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:

<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"                }            ]        }    }]};‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
6 REPLIES 6

jpotts
World-Class Innovator
World-Class Innovator
Please post your controller.

art99trash
Star Contributor
Star Contributor
I have updated the post to include the controller code.

I dont see any flaw in your code, you should be able to access noderef in your controller. Can you post error logs too!

I am attaching my catalina.out and a screenshot that shows that the NodeRef variable is getting the
value null.

niketapatel
Star Contributor
Star Contributor
Can you try this to get noderef in your controller ! As you have defined your action as pagetype

 var noderx = page.url.args.nodeRef ; ‍

That worked! Thanks!!