AnsweredAssumed Answered

How can I execute a Java script before creating new content

Question asked by hackerkok on Mar 14, 2019
Latest reply on Mar 14, 2019 by roberto.gamiz

I want to execute a Java script on content creation. The script should fetch a document from a url, given some parameters on a popup (same as the folder creation popup) and then upload it to alfresco.

 

I have followed the instructions here Adding a menu item to the "Create..." menu in DocLib | Alfresco Documentation but I can not find a way to initiate the Java code.

 

My content is type javascript:

<config evaluator="string-compare" condition="DocumentLibrary">
                    <create-content>
                        <content id= ....
                                 type="javascript">

.....

 

The function I used is onActionFormDialog, same as the document actions is done, but this doesn't seem to work.

 ....

                            <param name="function">onActionFormDialog</param>
                            <param name="itemKind">action</param>
                            <param name="itemId">...</param>  Repository action id = Spring Bean id
                            <param name="mode">create</param>
                            <param name="destination">{node.nodeRef}</param>
                            <param name="successMessage">...</param>
                            <param name="failureMessage">....</param>

 </content>
 </create-content>

.....

 

I guess that the onActionFormDialog function can not be used here, but I can not find an alternative.

 

 

Thank you in advance.

Outcomes