cancel
Showing results for 
Search instead for 
Did you mean: 

Pass params to a custom email template

redbull
Champ in-the-making
Champ in-the-making
Hi,
in wrote a custom action where, from the relative jsp dialog, I accept some text fields. At the end of the action I need to send an email using a custom template (.ftl) and I would pass the input fields (entered on the dialog) to the custom template so these fields "end up" in the email body.
I'm new using template and so I don't know where to start….
Thanks for the help.
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
When using a template there will be a model which contains the values to use and the template itself which displays that model.

If using free marker, your form data is your model and the email template formats the email message.

redbull
Champ in-the-making
Champ in-the-making
so:
this is the piece of code for the form data (that is my dialog "travel-select.jsp"):

……
      <td width="85%">
         </f:verbatim>
         <h:inputTextarea id="travel-destination" value="#{DialogManager.bean.travel-destination}" rows="4" cols="75" required="true"
                      onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
         <f:verbatim>
      </td>
……….
where travel-destination is the field that I would add into the email body
and this is the piece of FreeMarker code for email template:

……….
The travel destination you selected is as follows: ${travel-destination}.
……….

At runtime I get this error:


A system error happened during the operation: 00140004 Error during processing of the template 'Expression travel-destinationis undefined on line 3, column 16 in workspace://SpacesStore/4374c30e-39e8-4d20-bacf-5856f30e9cb4.'. Please contact your system administrator.
(note: workspace://SpacesStore/4374c30e-39e8-4d20-bacf-5856f30e9cb4 is the custom email template).

Where I went wrong? I forgot something else?
Thanks

redbull
Champ in-the-making
Champ in-the-making
…still no answer from the experts Smiley Surprised  Smiley Surprised
Any suggestions would be appreciated.
Thank