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.

How to get file name of the form attachment?

Avatar

Former Community Member

Hi,

is there anybody who is able to help me with the following problem???

I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.

I need to get file name of attached file in the process!!!

I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:

Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?

Thanks for your suggestions.

3 Replies

Avatar

Former Community Member

You can use an execute" operation (from the Set Value service) with the "getDocAttribute(com.adobe.idp.Document, String)" function (part of the Document functions available from the xPath builder UI.

Regards

Steve

Avatar

Former Community Member

Hi SForrest96.

Thanks for your reaction but method getDocAttribute(/process_data/@testDocument, "wsfilename") returns empty string in this case due to missing "wsfilename" attribute. The "getTaskAttachments" component can't get appropriate document attributes unfortunately.

Does anybody have another idea?

Thanks

Avatar

Former Community Member

Hi LekomDev,

I faced the same situation some time back and this is what I know.

Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)

The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.

So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.

But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.

Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.

hope this helps,

cheers,

Parth Pandya

Blog: http://livecyclekarma.wordpress.com