Attach file to email

Hi,

I'm trying to attach the files form a document to an email notification, like this:

<chain id="envoyerMail">
        <operation id="Context.FetchDocument" />
        <operation id="Notification.SendMail">
            <param type="string" name="from">expr:@{WorkflowVariables["expediteur"]}</param>
            <param type="string" name="message">expr:@{WorkflowVariables["message"]}</param>
            <param type="string" name="subject">expr:@{WorkflowVariables["subject"]}</param>
            <param type="stringlist" name="to">expr:@{WorkflowVariables["destinatiares"]}</param>
            <param type="boolean" name="HTML">false</param>
            <param type="stringlist" name="files">expr:@{Document["file:content"]},@{Document["files:files"]}</param>
            <param type="string" name="viewId">view_documents</param>
        </operation>
    </chain>

But I keep getting this error:

2014-07-04 16:49:31,203 ERROR [org.nuxeo.ecm.automation.core.operations.notification.SendMail] Error while fetching blobs: Property not found: org.nuxeo.ecm.core.storage.sql.coremodel.SQLBlob@5370ea
2014-07-04 16:49:31,203 ERROR [org.nuxeo.ecm.automation.core.operations.notification.SendMail] Error while fetching blobs: Property not found: [{file=org.nuxeo.ecm.core.storage.sql.coremodel.SQLBlob@1a4a35

One error per file.

Does anyone has ever done this?

Thank you.

0 votes

1 answers

1856 views

ANSWER



I found the solution, the xpath has to be declared as string and not as an expresion:

<chain id="envoyerMail">
        <operation id="Context.FetchDocument"/>
        <operation id="Notification.SendMail">
            <param type="string" name="from">expr:@{WorkflowVariables["expediteur"]}</param>
            <param type="string" name="message">expr:@{WorkflowVariables["message"]}</param>
            <param type="string" name="subject">expr:@{WorkflowVariables["subject"]}</param>
            <param type="stringlist" name="to">expr:@{WorkflowVariables["destinatiares"]}</param>
            <param type="boolean" name="HTML">false</param>
            <param type="stringlist" name="files">file:content,files:files</param>
            <param type="string" name="viewId">view_documents</param>
        </operation>
    </chain>
0 votes