function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LithiumsLithiums 

Need Expert Advice

I have put a button on an object, this object has some configuration settings. On clicking the button configuration needs to put in a xml format and the text file needs to be downloaded on to desktop or anyother location outside of salesforce.

 

On clicking the button, I am able to build the xml but I am having trouble putting the file on desktop. I know there is render as but I dont want any manual intervention for saving.

 

Can someone advice me on this....

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
<apex:page contentType="text/xml#configuration.xml" ...

Note that you can't influence the directory/folder in which the file will be saved (this is browser dependent), but the file name will be automatically populated (e.g. configuration.xml).

All Answers

sfdcfoxsfdcfox
<apex:page contentType="text/xml#configuration.xml" ...

Note that you can't influence the directory/folder in which the file will be saved (this is browser dependent), but the file name will be automatically populated (e.g. configuration.xml).

This was selected as the best answer
LithiumsLithiums

Thanks for that, It does resolve the issue to an extent.

 

I am trying to throw an alert box stating file is downloading or something, but when I add javascript it is not picking it up and it displays the code in the configuration file, is there any workaround.