AnsweredAssumed Answered

CIFS desktopactions - ScriptAction.execute error

Question asked by darcy on Nov 28, 2006
Latest reply on Nov 29, 2006 by darcy
Hello all,

I am using Alfresco 1.4.0 community.

I am having trouble running a desktop action in order to change the content type to a custom type when importing via CIFS. I am not sure I understand correctly how to do it. Here is what I have:

in file-servers-custom.xml:

               
<action>                             
      <class>org.alfresco.filesys.smb.server.repo.desk.JavaScriptDesktopAction</class>
      <name>JavaScriptAction</name>
      <filename>__AddIntranetContent.exe</filename>
      <script>alfresco/desktop/tcsAction.js</script>
      <attributes>anyFilesFolders</attributes>
      <preprocess>copyToTarget</preprocess> 
</action>

in alfresco/desktop/tcsAction.js:


function runAction()
{
   var script = actions.create("specialise-type");
   script.parameters["type-name"] = "tcs:content";
   script.execute(deskParams.getTarget(0).getNode());
}

runAction();
var response = "0,Javascript completed successfully";
response;   

When I invoke the action, I get a windows dialog error:


Error running action

Failed to execute supplied script: Can't find method org.alfresco.repo.jscript.Actions$ScriptAction.execute(org.alfresco.service.cmr.repository.NodeRef).

"specialise-type" is in the actions array available to the javascript action. If I understand correctly how that works, the script is mapped to the org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter class. Looking at the API, the execute method takes an additional parameter: org.alfresco.service.cmr.action.Action. The JavaScript API doesn't supply this parameter and I have no idea what I would supply for it.

In addition, if I use the "mail" example from the wiki, I get the same error. In this case I am supplying the same deskParams.getTarget(0).getNode() object to execute. From the API, that looks like the right param.

Changing the type to a custom type is the goal, there may be another way to do it that I am unaware of.

Any help would be much appreciated.

Thanks!

Outcomes