Scheduling JavaScripts

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2011 07:18 AM
Hi,
I was looking at Scheduling Actions in Alfresco here.
http://wiki.alfresco.com/wiki/Scheduled_Actions
It's mentioned that a scheduled action is made up of three parts, (1)a cron expression (2) a query template and (3) action template.
Is it mandatory to specify all three? Can I just mention (1)cron expression and (2)action template?
And I was going through the example here
http://wiki.alfresco.com/wiki/Scheduled_Actions#Script_Action_Example
there are lots of properties that are being set. Again, are all of them mandatory?
Please let me know, thanks!
I was looking at Scheduling Actions in Alfresco here.
http://wiki.alfresco.com/wiki/Scheduled_Actions
It's mentioned that a scheduled action is made up of three parts, (1)a cron expression (2) a query template and (3) action template.
Is it mandatory to specify all three? Can I just mention (1)cron expression and (2)action template?
And I was going through the example here
http://wiki.alfresco.com/wiki/Scheduled_Actions#Script_Action_Example
there are lots of properties that are being set. Again, are all of them mandatory?
Please let me know, thanks!
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2011 08:07 AM
Here is a complete example of what you need
<!– 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/demo/context/scripts/scheduledExpiringAgreements.js</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>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2011 03:08 AM
Thanks! Works like a charm.


Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2011 12:59 PM
Hi,
I'm trying to do the same, schedule a script and send a mail to users. Is there a way to inject the root scoped objects in the script ? Like companyhome, userhome… ?
Thanks
I'm trying to do the same, schedule a script and send a mail to users. Is there a way to inject the root scoped objects in the script ? Like companyhome, userhome… ?
Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2011 02:25 AM
Yes, it's possible. Take a look at this –> http://wiki.alfresco.com/wiki/3.4_JavaScript_API#Root_Scope_Objects
you could write something like this–
you could write something like this–
var name = userhome.properties.name
to get the userhome
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2012 06:27 PM
Loftux, where I put this code?
Scheduled-Action-Services-Context.xml in shared/classes/alfresco/extensions ?
Thanks!
Scheduled-Action-Services-Context.xml in shared/classes/alfresco/extensions ?
Thanks!
