Change pdf filename

Hey,

I just noticed that I can read a file object to runtime and use text edit components in the UI to edit both the file name and sequential ID of the object. When I persist it, these changes are stored in the database, even though they should be read only.

I was testing this because I want to be able to alter the file name of an existing PDF using action nodes. I could not find a way to do this, and was wondering if it will be implemented in the future.

Hi Petter,

It is not possible to update the (built-in) original file name using action nodes. Instead, you could add a new property to your file object class and then store the file name there. It is indeed possible to update not built-in data properties on a file object class by using the normal update object action node.

1 Like

Hi
We’ve registered a challenge for what you’re experiencing with a seemingly changed name and sequential identifier. If you refresh your app I expect you’ll see that they are reset to the original values.

1 Like

Ok I see, yes the values were reset after refresh.

Thanks for your responses!

Hi @Simona
I understand that is possible to add a new property to my file object and store the file name there, so within appfarm it can be displayed with another name. But is it possible to use that property as a file name when downloading the file or sending it as an e-mail attachment?
What i mean:
file has been uploaded with name: test.pdf
i would like to send this file as an attachment to email and i want file to be called customer[ID].pdf

Hi @Kjellamund !
The file name that will be applied if the file is downloaded by a user is the built-in property Original File Name. This means that you can override the Original File Name (it is called File Name in the Create File Object action) by using a function which returns customer[ID].pdf.

image

1 Like

Thank you. But it’s possible to change the name only when the file is created. If i want to change name for the existing file object, can i use the following workaround:

  1. create a new file object, set the Source type: URL and in the URL set data binding to the File content property of the old file object (one that i want to rename), and File name property to the new name i want to set (i.e. customer[ID].pdf.)
  2. delete the old file object