Expand my Community achievements bar.

Rename attachment filename

Avatar

Former Community Member
Hi,



I have a watched folder that read a pdf file into document variable in a workflow. In the workflow, the document is copy to an attachment. The problem is that, the filename of the attachment is alway "attach0". How can i change the filename before attach to the workflow?



I tried setDocAttribute with attribute name "filename", "name", or "file". None of them work.



Thank you for any help.
5 Replies

Avatar

Former Community Member
use one of the document object function called setDocumentAttribute. This function takes the document,the attribute to set,attributeProperty

so to set the filename of the attachment you would use

setDocumentAttribute(/process_data/documentTochange,"wsfilename","NewName.pdf")

The document functions can be found in the xpath builder in workbench

Any further question do let me know

thanks

Avatar

Former Community Member
Thanks for reply.



I tried using setDocAttribute but it does not work. I tried with different attribute name like "filename", "name", "file", all does not work.



I use the setDocAttribute on a document variable type before I attach the document to the user service operation.



Regards.

Avatar

Former Community Member
The attribute name is "wsfilename"

SetDocAttribute returns a document object,after you use the setDocumentAttribute add the returned document to a listOfDocuments, then pass this into the user service,you can mail me the process mergeandfuse@gmail.com

I can take a look

Avatar

Former Community Member
Thank you very much WorkflowUser, I have tried what you suggested and it works. My initial fault is because I used a string variable as the return for the setDocAttribute.



Thanks...:)

Avatar

Former Community Member
you are welcome,just happy was able to help you