cancel
Showing results for 
Search instead for 
Did you mean: 

Mail notification with content Info

rockycres
Champ in-the-making
Champ in-the-making
Hi,

In my process definition.xml,I have a script which will send mail notification with content name and other info .

           <script>
                 var mail = actions.create("mail");
                 mail.parameters.to = 'santhosh.sekar@gmail.com';
                 mail.parameters.subject = "HI";
                 mail.parameters.from = 'santhosh.sekar@yahoo.com';                 
                 mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/new.ftl");             
                 mail.parameters.text = "It's done end ";
                 mail.execute(bpm_package);     
           </script>

In the template,

    <h4>Current Document Info:</h4>
   <b>Name:</b> ${document.name}<br>
   <b>Ref:</b> ${document.nodeRef}<br>
   <b>Type:</b> ${document.type}<br>
   <b>DBID:</b> ${document.properties["sys:node-dbid"]}<br>

But this is not fetching the right results.

This is the output I am getting…

Current Document Info:
Name: www
Ref   : avm://www–workflow-2fa1924f-82a1-4b0d-b110-0e4f159d3e9a/-1;www
Type :{http://www.alfresco.org/model/wcmmodel/1.0}avmlayeredfolder
DBID:2,373

How do I fetch the correct name of the files which were created as a part of the current workflow…Any help is appreciated…
5 REPLIES 5

skorde
Champ in-the-making
Champ in-the-making
Hi
I also want to pass dcoument info with mail.any one has solution?

rockycres
Champ in-the-making
Champ in-the-making
Hi,This is the solution…

I have attached custom code to the workflow to send an email at specific spots in the workflow.so that the email should would show the files that are being changed in the current workflow context.I was able to implement it successfully and able to fetch the following info (as of now fetched created file names ,creator name & created time).



These are the following Alfresco config  changes :



1.I have customized the existing submission workflow to send an email notification to the approver regarding the files created.



In Submit_processdefinition.xml



<start-state name="start">

        <task name="wcmwf:submitReviewTask" swimlane="initiator"/>

          <transition name="" to="initialise">

         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">

           <script>

                 var mail = actions.create("mail");

                 mail.parameters.to = 'santhosh.sekar@etrade.com';

                 mail.parameters.subject = "Alfresco Task";

                 mail.parameters.from = 'santhosh.sekar@etrade.com';                 

                 mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/email_notify.ftl");             

                 mail.parameters.text = "It's done end ";

                 mail.execute(bpm_package);       

           </script>

         </action>

      </transition>               

   </start-state>



In free marker template(email_notify.ftl),



Current Document Info:



Name        : ${document.name}

Ref         : ${document.nodeRef}

Type        : ${document.type}

DBID        : ${document.properties["sys:node-dbid"]}



<#list document.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>

   NAME OF FILE(s) CREATED : ${child.properties.name}

   Created Date  : ${child.properties.created?datetime}

   Creator       : ${child.properties.creator}

</#list>



New file(s) are added by ${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>.



U can see the below mail generated when the content is created.




Current Document Info:



Name        : www

Ref         : avm://XXX–workflow-0d57b3ff-5f20-4a8e-8739-549e0719aeb1/-1;www

Type        : {http://www.alfresco.org/model/wcmmodel/1.0}avmlayeredfolder

DBID        : 639



   NAME OF FILE(s) CREATED : ODC_FILE_1.xml

   Created Date  : Mar 20, 2009 5:48:51 AM

   Creator       : admin

   NAME OF FILE(s) CREATED : ODC_TESting_2.xml

   Created Date  : Mar 20, 2009 5:49:19 AM

   Creator       : admin



New file(s) are added by SANTHOSH SEKAR.

skorde
Champ in-the-making
Champ in-the-making
good work yar!! and thanks for the help

roberto_negrete
Champ in-the-making
Champ in-the-making
Hi,

thanks so much, this is what I needet.

Regards.

pp20218
Champ in-the-making
Champ in-the-making
Hi,

I am also having the same requirement. can anyone help me how to initiate this flow.

I am not getting the submit for approval radio button in the advanced workflow page. I have only 2 default advanced workflow present(Adhoc and  Review & Approve (Review & approval of content))

Thanks
PP