AnsweredAssumed Answered

Using ajax in a rule

Question asked by jsolan on May 9, 2011
Latest reply on May 16, 2011 by jsolan
I'm trying to setup a rule to add information to a file and copy it to a proper location in alfresco 3.4.d.
Basically users are going to be scanning a document to the share and will have limited interaction.  Based on the filename they give I'm going to look up other information from a database.
What I would prefer to do is make an ajax call from a rule on the folder to a php script that returns the necessary information.

I'm familiar with dojo and the dojo.io.bind function as shown on the wiki here http://wiki.alfresco.com/wiki/AJAX_Support
But it's not clear to me if/how these can be used in a script when creating a rule.

I've tried making a dojo build with the needed files, uploaded it to the scripts directory, and attempted :
<import resource="/Company Home/Data Dictionary/Scripts/dojo.js">
which i found in the wiki here http://wiki.alfresco.com/wiki/JavaScript_API_Cookbook
I get an syntax error when trying to execute my script with that import line in there
15:28:32,301 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 04099633 Failed to execute script 'workspace://SpacesStore/a5ea6262-1062-4892-b200-922a9b6659df': syntax error (workspace://SpacesStore/a5ea6262-1062-4892-b200-922a9b6659df#12)
org.alfresco.scripts.ScriptException: 04099633 Failed to execute script 'workspace://SpacesStore/a5ea6262-1062-4892-b200-922a9b6659df': syntax error (workspace://SpacesStore/a5ea6262-1062-4892-b200-922a9b6659df#12)
.

Any help would be greatly appreciated.

Outcomes