cancel
Showing results for 
Search instead for 
Did you mean: 

Email's attachment from Activiti

angello0571
Champ on-the-rise
Champ on-the-rise
Hi everyone,

I wonder if it is possible to attach a file in an email from activiti.

I figured out that I can get the file's Node Reference and send a link in the email.

Looking for the current task's variables into act_ru_variable table, I noticed that it has bpm_package, initiatorhome, companyhome, initiator, bpm_packageActionGroup and bpm_packageItemActionGroup, among some others (Of course these variables are taken from the workflowModel).

They have as value a reference to the workspace://SpaceStore//… but none of them matches with the Node Reference of my document.

Is anyone that could give me some tips or links to check about this, and get the Node Ref of the Item file of my Task ?

Thanks in advance.
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
bpm_package is a folder that contains every document being routed in the workflow. Iterate of the folder's children to iterate over the documents in the workflow. So, the nodeRef of the first document in the workflow would be:
bpm_package.children[0].nodeRef

Jeff

angello0571
Champ on-the-rise
Champ on-the-rise
I'm going to try it Jeff, it looks simple Smiley Happy

Once more time thank you for your explanation.

Best Regards.

Angello.

jpfi
Champ in-the-making
Champ in-the-making
Hi,
get the content of the document via contentService & prepare a multipart mail.
Mails in Activiti-WFs within Alfresco are triggered by org.alfresco.repo.workflow.activiti.tasklistener.TaskCreateListener & send via MailAction (org.alfresco.repo.action.executer.MailActionExecuter).

The MailActionExecuter doesn't support attachments, so you'll need to add your own code.
This might be helpful: send attachments via JavaMailSender: http://stackoverflow.com/questions/3177616/how-to-attach-multiple-files-to-an-email-using-javamail
Cheers, jan

angello0571
Champ on-the-rise
Champ on-the-rise
Hi here is MailActionExecuter http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/repository/source/jav..., just add the code for attachment functionallity Smiley Happy and configure your class in the appropiate spring xml config file.

If you have any question I can help you Smiley Wink

Regards!