Using mail folder to create a reply email message?

I have a requirement to implement a reply function using an extended Nuxeo mail folder.

Basically I need to include the Nuxeo stored subject and message body as well as the from/to email addresses in the mailTo mail action when the from field is clicked in the extended mail folder's content view.


Since I do not have the standard mail content view when I extended the mail folder: What .xml extensions to I need to provide/override in Studio to get the standard mail content view and add the subject and email body text to the 'reply” email?

Is there a better approach?

Is Java Mail an overkill?

Thanks, in advance for any assistance.

0 votes

5 answers



Actually, I think that your null pointer exception is for the object “Document”. What you should do is, just after the Fetch Selected Documents, to run an Execution Flow > Run Document Chain. The reason is that the “Document” object is not available when the input is “Documents”.

You can see a sample of this at the page 99 on the following slides

A stacktrace would help to make sure of what is null.

0 votes

How is you Automation chain called from the UI? A button? An action? Something else? This is not clear to me from your description as you did several different tests.

Normally chains that are called through action buttons or links produce an action link of #{operationActionBean.doOperation('yourchain')} and this propagates the Seam context automatically. Are you doing the call differently?

If you call a Seam-related operation from an Automation chain that's not called through Seam, you have to propagate the proper Seam context from the UI level by passing the conversationId.

To do that you have two choices:

0 votes

Automation chain is called from UI via a button, created in Studio and linked to a content view. The button is next to the Delete, Add to worklist, Copy buttons on the content View. The content view is displaying the contents of a extended MailFolder.Add to worklist button works ok, my button does not, so I looked at how the Add to worklist button works for an example. I have used SEAM outside of Nuxeo, for other projects, so I assumed, as stated above, the SEAM context (conversationId) is handled "under the covers" if I used a simple Studio UI implementation.

The content view is created with a Studio layout, using a set of templates used to display email message fields by the standard email folder. I needed to extend the email folder to create the button(s) I need to work on the email messages contained in the folder.

I tried using a similar button on the standard MailFolder with filters in the user action to display the button only on a MailFolder and got the same result: a null when I went to access the fields in the selected email message.


It appears this class(GetSelectedDocuments) is getting a Null value from the DocumentsListManager, yet the ClipBoardActionsBean (called by “Add to worklist” button) seems to be working (non null) with a similar call to DocumentsListManager.

ClipBoardActionsBean fails more gracefully if a null is found.

The GetSelectedDocuments call looks like “almost” the same call except for the OperationsHelper wrapper.

I guess that's where I'll go next……. on to OperationsHelper.

0 votes

Looks like OperationsHelper gets a SEAM DocumentsListManager from a SEAM utility called Contexts.

While the ClipBoardActionBean is a SEAM component and creates it's own session with DocumentListManager being injected by SEAM.

Now the big question is do I have a SEAM CONVERSATION context to get the selection on the email listing?

If not can I create one?

Can I use User Interface->Push to SEAM Context to create what I need: A Document Context with a selected row?

If so what name do I use for the "pushed" document?

I assume I can use the SEAM conversation scope.

Anyone care to confirm?


After looking at DocumentListManager my guess is:

My content view button causes GetSelectedDocuments to be called. GetSelectedDocuments because it is not a SEAM component needs to call SEAM utility CONTEXTS via OperationsHelper to get a DocumentsListsManager instance. Since OperationsHelper is not a SEAM component the call to Contexts to get DocumentsListsManager creates a different SEAM session than the one needed by the content view action chain, hence, the null value returned by the UI Selected Documents call.

Can I do anything without modifying OperationsHelper?

Sanity check?




Finally got around to trying this. Here are my results so far……

I have a user action which fires the automation chain that seems to work.

When I tried number 3 above I got an error complaining about Null document.

The context of the document does not seem to be available to the automation chain after the I use the Fetch->UI Selected Documents.

I simplified the troubleshooting by trying to just output some of the email fields in a message block to verify the context using User Interface-> Add Info Message with fields like dc:title and mail:sender by using expr:@{Document[“mail:sender”]} as the message content. I've also tried #{Document['mail:sender”]} with the same result: I get a blank for the message. If I put a prefix on the output only the prefix prints.

Any suggestions?

0 votes

I tracked this problem to the Fetch-> UI Selected Documents does not seem to working correctly.

My content view consists of a set of templates, manually entered using widget template editor int Studio. These templates displays the mail messages using an extended document. I get the folder context (container of the email messages) but the UI selected Document is null and this throws an exception when I try to read the mail message fields.

Do I need parameters to be passed to make the Fetch->UI Selected Documents? If so which parameters are needed?


I still cannot get past number 3 on the listing.

The selected message context is not being passed to the action chain.

Any takers?


A few more pieces to this puzzle.

1: "Add to worklist" selections work for single and multiple selections.

2: When I change my action chain to use Fetch->Context Documents (instead of Fetch->UI Selected Documents) I can access the fields of the extended MailFolder.

3: Standard (non-extended) MailFolders (with no explicit content view) have the same issue, when I setup of an action chain to fire on this type of folder I cannot access the fields of the selected row in the content view listing.

Sounds like JIRA material?

Any comments?



Here is a suggestion of how you could do:

  1. Create a MailResponse Document type (or not, you could simply use in the step after, the MailMessage)

  2. Add a User Action on the Document Summary Actions filtering on MailMessage document type.

  3. In the automation chain bound to the user action,use multiple time “set context variable” to put in the context of the chain the value of the fields that stores the sender and the body of the email you want to reply to,

  4. In the same automation chain,get the parent MailFolder, then use Document > Create to create a document of type MailResponse (orMailMessage). For the properties, use the context variable you computed previously, so that you update the title (with a “Re” prefix string), the recipients and the begining of the body. You can use the Service > Create Relation to create a relation between them at the same time.

  5. In the same automation chain, use UI > Navigate to Document to go to the document type

  6. In the same automatin chain, use UI > Change tab to switch to edit tab. (That's why I think you'd better have your own mail response document type)

  7. Add a user action displayed in the Document edition form category that save and send the email (using the Notification > Send Email operation)

That's is just the idea. I can give a complete solution tomorrow if necessary.

0 votes

Thanks, I will try this method as soon as I get the extended mail folders working correctly. See my latest posting.