cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduled Actions is not working...

mcasanket
Champ on-the-rise
Champ on-the-rise
Hi all,

  I am using alfresco 3.4. I have created one scheduler that will execute my js file. I have copied it from the http://wiki.alfresco.com/wiki/Scheduled_Actions#Script%20Action%20Example.

I have put scheduled-action-services-context.xml file in my extention folder and uploaded my.js file at company_home space.

But the scheduler seems to be not working as the java script doesn't run. My java script file contains only one log statement like logger.log("This is a test.");

However it is not showing any error on too…

my  scheduled-action-services-context.xml  file is as under.

<beans>
    <bean id="templateActionModelFactory" class="org.alfresco.repo.action.scheduled.FreeMarkerWithLuceneExtensionsModelFactory">
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
    </bean>
   
    <!–
    Execute the script /Company Home/Data Dictionary/Scripts/alfresco_docs.js
   –>
   
    <bean id="runScriptAction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
        <property name="actionName">
            <value>script</value>
        </property>
        <property name="parameterTemplates">
            <map>
                <entry>
                    <key>
                        <value>script-ref</value>
                    </key>
                    <!– Note that as of Alfresco 4.0, due to a  Spring upgrade, the FreeMarker ${foo} entries must be escaped –>
                   <value>\$\{selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/cm:my.js"' )\}</value>
               
                </entry>
            </map>
        </property>
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="dictionaryService">
            <ref bean="DictionaryService"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
    </bean>
   
    <!–
   Run the script every minute - select the single node company home that is not used …
    –>
    <bean id="runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
        <property name="transactionMode">
            <value>ISOLATED_TRANSACTIONS</value>
        </property>
        <property name="compensatingActionMode">
            <value>IGNORE</value>
        </property>
        <property name="searchService">
            <ref bean="SearchService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
        <property name="queryLanguage">
            <value>lucene</value>
        </property>
        <property name="stores">
            <list>
                <value>workspace://SpacesStore</value>
            </list>
        </property>
        <property name="queryTemplate">
            <value>PATH:"/app:company_home"</value>
        </property>
        <property name="cronExpression">
            <value>0 0/1 * * * ?</value>
        </property>
        <property name="jobName">
            <value>jobD</value>
        </property>
        <property name="jobGroup">
            <value>jobGroup</value>
        </property>
        <property name="triggerName">
            <value>triggerD</value>
        </property>
        <property name="triggerGroup">
            <value>triggerGroup</value>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="templateActionDefinition">
            <ref bean="runScriptAction"/> <!– This is name of the action (bean) that gets run –>
        </property>
        <property name="transactionService">
            <ref bean="TransactionService"/>
        </property>
        <property name="runAsUser">
            <value>System</value>
        </property>
    </bean>
</beans>


Please help me…
3 REPLIES 3

mcasanket
Champ on-the-rise
Champ on-the-rise
Thanks Dranakan for your quick reply!

  Actually in one or two sites I read that someone has done it (don't remember the sites names.). But don't know what is going wrong with this… In my project the client wants to use this only….  Smiley Sad 

 
Hello,

There is a bug with 3.4D : https://issues.alfresco.com/jira/browse/ALF-9981
https://forums.alfresco.com/en/viewtopic.php?f=27&t=40082#p117516


Thank you once again 🙂

fstnboy
Champ on-the-rise
Champ on-the-rise
Hi mcasanket,

Could you try not escaping? So:


<!– Note that as of Alfresco 4.0, due to a Spring upgrade, the FreeMarker ${foo} entries must be escaped –>
<value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/cm:my.js"' )}</value>

Regards
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.