cancel
Showing results for 
Search instead for 
Did you mean: 

Document effectivity aspect email notification

nikes
Champ on-the-rise
Champ on-the-rise
Hello all,

I need to implement email notification on effectivity aspect of document.

Lets say if I apply effectivity aspect to document, I want send email to users before particular days/time reminding for expiry of document.

How can I implement this in Alfresco?

Thanks in advance,
Nikesh
12 REPLIES 12

nikes
Champ on-the-rise
Champ on-the-rise
Please guide if you guys have any idea.

nikes
Champ on-the-rise
Champ on-the-rise
Still looking for the solution

mrogers
Star Contributor
Star Contributor
Look here -> http://wiki.alfresco.com/wiki/Content_Expiration

If that does not do what you want the same principles apply.   Run a scheduled job to check for "effectivity" and process actions according to your buisness rules.

nikes
Champ on-the-rise
Champ on-the-rise
The link given talks about WCM. I want implement in DM module.

Can you provide some sample job scheduler example here or some link?

I have never implement scheduling in Alfresco. Your guidance would be very helpful for me.

thanks,
Nikesh

nikes
Champ on-the-rise
Champ on-the-rise
I am able to send notification using scheduler.

My updated requirement is…..

I developing a solution for UK work permit project….which stores documents of all employees work permit.
This document has expiration date property.
I want to remind employees say before 6 months of expiry of document.

I have written javascript to send email to hard coded email address. But I want to send email to employees whose work permits expires based on business rule dynamically.

I have added an aspect to document to contain email address,, but dont know how to fetch it in scheduler javascript action.

When I fetch documents having particular aspect applied to it, what properties it returns? from luceneSearch() method.

Thanks for any help.
Nikesh

yasosaran
Champ in-the-making
Champ in-the-making
Hi Nikesh,

Could you please help me or share how you acheived this? We are looking on implementing something like this , holding the documents for 4 months and send email notification to the users who have access to the document about the expiration.

Could you please guide or point me to some pointer on how to add effectivity aspect and sending notices.

Thanks

nikes
Champ on-the-rise
Champ on-the-rise
I am listing down what I did, what I achieved and what still needs to be achieved…………………

What I did………….

1.     Apply rule to your folder for attaching out-of-box "effectivity" aspect……
2.     Add some sample documents and apply expiry date to it.
3.     Rename "scheduled-action-services-context.xml.sample"  by removing ".sample" extension.
4.     Write some Javascript to send email. I uploaded script in Company Home folder (Best place might be data dictionary/script folder……..)
5.     In scheduled-action-services-context.xml define your bean to execute javascript and cron expression using lucene query.
6.     Restart your server. Scheduler will start sending email to mentioned address on defined time interval.

What I achieved…………
1. I have hardcoded emaill address in javascript. If i have two documents matching scheduler requirements, I am getting two emails in my Inbox.

What still needs to be achieved……..

1.   I want to fetch email address in Javascript from document property……. so that email would be sent to concerned person or group only.
2.   I want to execute action (email) only once containing all document list. Currently if condition finds 5 documents, it is sending 5 emails.
3.  In email body I want to display Document properties like………….
     a) Document name
     b) Expiry date…… etc…..


For those who want some link for basic of scheduling………
http://wiki.alfresco.com/wiki/Scheduled_Actions

Lucene search related…..
http://wiki.alfresco.com/wiki/Search

In query template we can write something like this:
@cm\:to:"2009-05-31T00:00:00.000Z"
Also refer above link for date range syntax.

I would request Alfresco members to add some inputs to my pending requirements…

Thanks in advance for any help..  Smiley Happy
Nikesh

baby77
Champ in-the-making
Champ in-the-making
Hi guys me to is trying to figure it out how work scheduled action.
I want to send mail to person using scheduled not every time when document arrive to space but to set some time to check if new document is still in the space and need to be approved.
I do all steps in scheduled-action-services-context.xml and include js to send mail but i dont get it to work. Js is working fine.
Why this won't work? I follow all steps written on wiki.
Some help needed here.
Thanks.
Here is my scheduled-action-services-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
     <!–
    Define the model factory used to generate object models suitable for use with freemarker templates.
    –>
    <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/    –>
    <bean id="test_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>
          <value>{selectSingleNode('workspace://SpacesStore', 'lucene',
                    'PATH:"/app:company_home/app:dictionary/app:scripts/cm:sendMail.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>
   
   
    <bean id="runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
        <property name="transactionMode">
            <value>UNTIL_FIRST_FAILURE</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>
        <!– Find all nodes that do not have the aspect –>
        <property name="queryTemplate">
      <value>PATH:"/app:company_home"</value>
        </property>
        <property name="cronExpression">
      <value>0 0/3 * * * ?</value>
        </property>
        <property name="jobName">
            <value>jobA</value>
        </property>
        <property name="jobGroup">
            <value>jobGroup</value>
        </property>
        <property name="triggerName">
            <value>triggerA</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="test_runScriptAction"/>
        </property>
        <property name="transactionService">
            <ref bean="TransactionService"/>
        </property>
        <property name="runAsUser">
            <value>System</value>
        </property>
    </bean>
     
</beans>

baby77
Champ in-the-making
Champ in-the-making
Hi i figure it out.
The only mistake was that I forgot to set the $ before selectSingleNode.
After that scheduled action start working. Smiley Happy