AnsweredAssumed Answered

Help with JavaScript actions?

Question asked by martinbramley on Dec 13, 2007
Hi,

Can any of you help with the following simple Alfresco JavaScript action?

The intended outcome is that the browser should return to the current page having called the javascript action which outputs the the variables passed in.

I've defined a new action & action-group as below:

         <action id="pindar_test">
            <label-id>view_details</label-id>
            <image>/images/icons/View_details.gif</image>
            <script>/Company Home/Data Dictionary/Scripts/pindarTestScript.js</script>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>

         <action-group id="pindar_test_actions2">
            <action idref="pindar_test" />
         </action-group>

In my dashlet I have:

<r:actions id="col8-actions" value="pindar_test_actions2" context="#{r}" showLink="false" styleClass="inlineAction" />

Where #{r} is a workflow task. Looking at the resultant code in my browser the generated URL is:

http://localhost:8080/alfresco/command/script/execute?scriptPath=%2FCompany%20Home%2FData%20Dictionary%2FScripts%2FpindarTestScript.js&id=jbpm%2453

In my javascript file I have:

logger.log("Hello world");
logger.log("Args :" + args);

"<script>history.go(-1);</script>"

The output I get from running this action is:

17:41:39,171 DEBUG [repo.jscript.ScriptLogger] Hello world
17:41:39,171 DEBUG [repo.jscript.ScriptLogger] Args :null
17:41:39,187 DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 16ms

Why is the args variable null? I would have expected the value to be the taskId?

Outcomes