AnsweredAssumed Answered

Access NodeRef in Webscript

Question asked by art99trash on Feb 23, 2016
Latest reply on Feb 26, 2016 by art99trash
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"
                }
            ]
        }
    }]
};

Outcomes