Import javascript into workflow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2007 02:20 PM
When writing a workflow, can you import a javascript file from the repository into the workflow instead of actually writing it all in the xml file? I tried something like this, but it did not work:
Thanks a lot,
Nick P
<script> <import resource="/Company Home/Data Dictionary/Scripts/someJS.js"></script>
Thanks a lot,
Nick P
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 05:56 AM
In theory, yes. I haven't attempted this myself, so can't be sure.
Can you clarify that your code is inside:
What sort of error did you see?
Can you clarify that your code is inside:
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> … </script></action>
What sort of error did you see?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 08:26 AM
At first I tried this:
And I got an error during deployment that said the "import" tag needed an end tag. So, I added a forward slash onto the end of the tag:
I then got the error from graph.def.GraphElement:
It looks like it's just not evaluating the "import" tag. That's why I thought it might just be a syntax problem….
<action name="notHiredAction" class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <!– This is where the javascript should be imported –> <script> <import resource="/Company Home/Data Dictionary/Scripts/someJS.js"> </script></action>
And I got an error during deployment that said the "import" tag needed an end tag. So, I added a forward slash onto the end of the tag:
<action name="notHiredAction" class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <!– This is where the javascript should be imported –> <script> <import resource="/Company Home/Data Dictionary/Scripts/someJS.js" /> </script></action>
I then got the error from graph.def.GraphElement:
action threw exception: Script expression has not been provided.
It looks like it's just not evaluating the "import" tag. That's why I thought it might just be a syntax problem….

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 11:21 AM
Wrap your script in a CDATA block e.g.
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <expression> <![CDATA[ <import resource="/Company Home/Data Dictionary/Scripts/test return value.js"> ]]> </expression> <variable name="theresult" access="write" /> </script> </action>
