AnsweredAssumed Answered

Scheduled script, mail sending and i18n

Question asked by jrott on Oct 17, 2011
Hi,

I created a scheduled script following this post : https://forums.alfresco.com/en/viewtopic.php?f=53&t=39242

My bean defeinition :
   <!– Run a job daily at 8.30 to send out an email about expiring agreements –>
    <bean id="scheduledExpringAgreements" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass">
            <value>org.alfresco.repo.jscript.ExecuteScriptJob</value>
        </property>
        <property name="jobDataAsMap">
            <map>
                <entry key="scriptLocation">
                    <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
                     <constructor-arg>
                        <value>alfresco/module/PATH_TO_JS_FILE</value>
                     </constructor-arg>
                  </bean>
                </entry>
                <entry key="scriptService">
                    <ref bean="ScriptService"/>
                </entry>
                <entry key="authenticationComponent">
                   <ref bean="authenticationComponent"/>
                </entry>
            </map>
        </property>
    </bean>
   
    <bean id="scheduledExpiringAgreementsTrigger" class="org.alfresco.util.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="scheduledExpringAgreements" />
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
        <property name="cronExpression">
            <value>0 30 8 * * ?</value>
        </property>
    </bean>

The script is scheduled and running fine. It creates a mail and calls a template, following this post http://www.abstractive.ca/home/blog/~/blog/tim.frith/alfresco_process_template_on_classpath
var result = nodeUtil.processClasspathTemplate("alfresco/templates/email/MyTemplate.ftl", args, myNode);

Everything works fine, but I'd like to go a bit further and localize the mail.
So, is there a way to import in the scheduled script or in the ftl template i18n properties ?

Thanks.

Outcomes