Dynamic Name For Downloaded File

Hello Friends ,

I am working on an app in which in which a user would press a button and a PDF file will be download in his device and i was able to do that but my only concern is file name of the downloaded file can it be changed according to the button pressed ? i already searched the community and could not find any solution
I have a idea please read further it may look stupid but I’ve never coded before so bare with me

  1. i will initialize a global variable to a text “empty”.
  2. when a user presses a button i will change the value of global variable “Desired file name”
    Screen 1

3.now using extendedwebviewer when .downloadneeded block in place of file name i would like to call the Global Variable which is a “Desired file name”
Screen 2

is it possible please correct me if you have better idea please share
Thank you