Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Problem with Email - Send with Document

Avatar

Former Community Member
I am having a problem with assigning an attachment name in my send with document process.



I can successfully send the email with the document but it doesn't have a filename. I have the xml data in an xml type variable and have verified that it is there using variable logger.

My problem is that I can't get the data out of of the xml variable to assign the name of the form being emailed. I need to use three different nodes for the file name. I have tried xpath and template but have had no luck.



Can anyone help?



Thanks,



John
2 Replies

Avatar

Former Community Member
The Attachment field is expecting a document variable and not XML. To get the XML into a document variable you will have to create a new variable of type document, then using a setValue service you can equate the XML variable (the right side of the equation) to the document variable (the left side of the equation).



The attachment filename can be an XPath expression where you build the name from the three values you want in the XML variable. In the Attachment name field (by default it is a literal value - change this to an XPath expression). The input box will change and a button with three dots will appear. Click the button and the XPath editor will appear. Now you can build an XPath expression to represent your file name. In the center of the XPath Builder is a dropdown that has different categories of XPath expressions. Choose the string category, the box below it will show all of the XPath string functions that are available. Choose the concat function, and replace the strings with what you want.



To get a value out of your XML var you can place your cursor where you want the expression to appear in the statement then choose your var from the list of variables at the top of the builder (double click it). The expression /process_data/xmlVarName will appear. You can add a //nodename to have XPath search through your XML and get the value back. This will be placed in your concat expression. So if we were lookinng for a node called file_name and file_extension (in the same XML file) your expression would look like this:



concat(/process_data/xmlVarName//file_name, ".", /process_data/xmlVarName//file_extension)



This expression will take the value contained in File_name add a period then the value in file_extension and stick all three together into a single string.



Make sense?

Avatar

Former Community Member
Paul,



This worked perfect! Thank you again!!



John