On download file name should be dynamic

He Team,

I am trying to download a file from API. The file name is dynamic. On download, it is taking default screen name as the file name when SAVE ON DISK option is NO.

How to make file name dynamic?

Hello Amreen,

Are you assigning the file name to local Variable FileName before downloading it?

1)Create a local Variable "FileName".
2)Get the FileName you are trying to download from API and assign it to the local variable.
Hope you did something as above.

Naren wrote:

Hello Amreen,

Are you assigning the file name to local Variable FileName before downloading it?

1)Create a local Variable "FileName".
2)Get the FileName you are trying to download from API and assign it to the local variable.
Hope you did something as above.

Hi Naren,

I had already assigned to a variable. But not working


Something like this works on mine:

Amreen Shaikh wrote:

Naren wrote:

Hello Amreen,

Are you assigning the file name to local Variable FileName before downloading it?

1)Create a local Variable "FileName".
2)Get the FileName you are trying to download from API and assign it to the local variable.
Hope you did something as above.

Hi Naren,

I had already assigned to a variable. But not working



Are you assigning the variabel inside the GetDocument action?

Hello Amreen, 

By your image, you are setting the file name, in the download tool, using the Filename variable. 

But the file comes from the Get Document, right? 

This action does not return the file name? 

If it returns, you can use the (just an example) GetDocument.FileName directly in the download widget instead of the variable... 

Could you explain where and how are you setting the Filename variable? 

Cheers 

Eduardo Jauch wrote:

Hello Amreen, 

By your image, you are setting the file name, in the download tool, using the Filename variable. 

But the file comes from the Get Document, right? 

This action does not return the file name? 

If it returns, you can use the (just an example) GetDocument.FileName directly in the download widget instead of the variable... 

Could you explain where and how are you setting the Filename variable? 

Cheers 

Hi Eduardo,

1.I am trying to preview my .pdf file first before downloading. In the preview, I am not able to see my filename in the preview .This is the actual problem I am facing.

2.The file name is input to the GetDocument API.




Solution

Hi Amreen,

According to this, this is a chrome extension problem, that I don't think you can easily fix:

https://stackoverflow.com/questions/53548182/can-i-set-the-filename-of-a-pdf-object-displayed-in-chrome

Basically, the chrome extension looks for the filename in the URI, and have it as a parameter does not work, it seems.

So, as every browser has a different "standard" viewer, you may have better luck using a PDF viewer instead of relying on the one provided by the browser, like this one from Forge: https://www.outsystems.com/forge/component-overview/2661/pdfjs-viewer

Cheers.

Solution