<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How send email document attachment using workflow service task in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-send-email-document-attachment-using-workflow-service-task/m-p/4143#M1757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am new on Alfresco community version 5.2&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need send email when new document is uploaded in folder and attach it to the email.&lt;/P&gt;&lt;P&gt;I found some approaches but I cannot use any of them.&lt;/P&gt;&lt;P&gt;I created rule and script like this&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.alfresco.com/thread/204201-attach-a-document-into-an-email?commentID=677786#comment" title="https://community.alfresco.com/message/677786-re-attach-a-document-into-an-email?commentID=677786#comment-677786?q=How%20send%20document%20attachment" rel="nofollow noopener noreferrer"&gt;https://community.alfresco.com/message/677786-re-attach-a-document-into-an-email?commentID=677786#comment-677786?q=How%2…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next I have tried start workflow by script and send email using service task (JavaDelegateClass) but there is problem get document &lt;IMG src="https://connect.hyland.com/legacyfs/online/alfresco/emoticons/confused.png" /&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;P&gt;1) I have to set document as parameter in script&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workflow.parameters.docnode = document;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2) in java service task (JavaDelegateClass)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActivitiScriptNode scriptNode = (ActivitiScriptNode) execution.getVariable("docnode");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NodeRef docref = scriptNode.getNodeRef();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContentReader reader = contentService.getReader(docref, ContentModel.PROP_CONTENT); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStream originalInputStream = reader.getContentInputStream();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageBodyPart = new MimeBodyPart(originalInputStream);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;contentService.getReader(docref, ContentModel.PROP_CONTENT) causes an exception&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Caused by: java.lang.NullPointerException&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;docref = workspace://SpacesStore/c20bd21d-90d3-497f-9e0a-28951649116e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I search docref in node browser and&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;00300000 Node workspace://SpacesStore/c20bd21d-90d3-497f-9e0a-28951649116e does not exist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What is the problem?&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;Help me please how can JavaDelegateClass access to document in workflow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2017 12:42:35 GMT</pubDate>
    <dc:creator>pnature</dc:creator>
    <dc:date>2017-01-25T12:42:35Z</dc:date>
    <item>
      <title>How send email document attachment using workflow service task</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-send-email-document-attachment-using-workflow-service-task/m-p/4143#M1757</link>
      <description>Hi,I am new on Alfresco community version 5.2&amp;nbsp;I need send email when new document is uploaded in folder and attach it to the email.I found some approaches but I cannot use any of them.I created rule and script like thishttps://community.alfresco.com/message/677786-re-attach-a-document-into-an-email?</description>
      <pubDate>Wed, 25 Jan 2017 12:42:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-send-email-document-attachment-using-workflow-service-task/m-p/4143#M1757</guid>
      <dc:creator>pnature</dc:creator>
      <dc:date>2017-01-25T12:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: How send email document attachment using workflow service task</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-send-email-document-attachment-using-workflow-service-task/m-p/4144#M1758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class=""&gt;&lt;P&gt;I think that Activiti workflow cannot access repository internally through services. It has to use external APIs.&lt;/P&gt;&lt;P&gt;But just created file don't exist for external APIs.&lt;/P&gt;&lt;P&gt;I found solution in putting document into&amp;nbsp;ASSOC_PACKAGE_CONTAINS as binary array.&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2017 09:59:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-send-email-document-attachment-using-workflow-service-task/m-p/4144#M1758</guid>
      <dc:creator>pnature</dc:creator>
      <dc:date>2017-02-16T09:59:08Z</dc:date>
    </item>
  </channel>
</rss>

