cancel
Showing results for 
Search instead for 
Did you mean: 

webscript - reference to 'workflow' giving error

robain
Champ in-the-making
Champ in-the-making
I get this error when i use "workflow" in the .js file
org.mozilla.javascript.EcmaError - ReferenceError: "workflow" is not defined. (AlfrescoScript#3)

but the reference to same object from the template file works fine.

anyone has idea what the problem is

Thanks
4 REPLIES 4

jbarmash
Champ in-the-making
Champ in-the-making
From template file - I am assuming you mean from Freemarker?  From documentation, worflow is only exposed in JavaScript in 2.9 labs.  Which version are you using?
    http://wiki.alfresco.com/wiki/JavaScript_API#Workflow_API

Those APIs are getting exposed separately. Freemarker gets its own set of objects, and JavaScript others, they are not equivalent. 

Hope this helps.   Not sure what the actual problem is.

robain
Champ in-the-making
Champ in-the-making
Thanks for the reply.
I am using 2.1.2 enterprise version. So I cannot access workflow from javascript on that version ?

jbarmash
Champ in-the-making
Champ in-the-making
Looks like you can't.  I just checked, and with 2.2 you can't either.  It does make sense it's exposed in some of the newer stuff, since with adding multi-tenancy, they are exposing workflow to be easily dynamically reloaded. 

One thing you can do is expose a proxy class to JavaScript yourself. 
     http://wiki.alfresco.com/wiki/JavaScript_API#Adding_Custom_Script_APIs

You can look inside script-services-context.xml to see how these things get exposed, and follow the code.  It might be not too hard, actually, depending of course on how much functionality you need exposed.  

If you need an example, I can email you a sample I put together for how to expose this - not relating to workflow, but might help (it will be part of our upcoming enterprise network). Email me at jbarmash at alfresco dot com.

robain
Champ in-the-making
Champ in-the-making
Thanks for the info.