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.

getDocAttribute() issue

Avatar

Level 3
I've tried to use the XPath method getDocAttribute("filename") to get the original name of an attachment (receive mail action) without success.

I've also tried "name" and "file" but it didn't work either.



Finally I found out, that content-type (getContentType()) contains the filename too (e.g.: 'application/pdf;name="file.pdf"').

I found nothing about that issue in the manuals.



Does anybody know if that behavior is a bug or if the documentation is not up-to-date.



kind regards

Michael
6 Replies

Avatar

Level 10
Try "wsfilename" see if that gets you the document name.



Jasmin

Avatar

Level 3
Hi Jasmin,



thanks for your answer.



getDocAttribute(/process_data/@attachment, "wsfilename") does not work either.



Michael

Avatar

Former Community Member
I have done this many times in all versions of the product without issue....I use the syntax



getDocAttribute(/process_data/@attachment, "file") and assign it to a string variable in a SetValue service.



The wsfilename attribute that Jasmin refers to would only be used if the attachment came from that envelope that is used in workspace.



Are you using an email endpoint or an email service inside of a process to get the attachment into the process?

Avatar

Level 3
Hi Paul,



thanks for your answer.



I use the email service for receiving emails which stores the attachments into a list of documents. Then I iterate through the list of attachments and extract the filename.

The getDocAttribute() method returns null, but the getDocContentType() method also contains the original filename.



I assume that the receive mail service does not set the attributes correctly.



kind regards

Michael

Avatar

Former Community Member
I think you are right ..... I can assure you that it is set every other way. I have not used it your way yet so I cannot comment on it. I will try it and see.

Avatar

Level 4
Michael Feichtegger,



If you are still facing this problem, have you tried using a Map instead of a List variable to store you attachments in?



If you use a map, the filenames of the attachments are used as the Keys of the map.



Regards,