You need to sign in to do that
Don't have an account?

download xml file by click a button on VF page
Hi buddys,
I have a VF page like the below one.Now when i am going to click on "OK" Button,i need to download that XML file and i need to insert that XML file in related Attachments.Any idea...
<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection collapsible="false">
<apex:outputText value="{!xmldata}" style="width:1000px;"></apex:outputText>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Back" onclick="window.top.close();"/>
<apex:commandButton value="OK" onclick="window.open('/{!recid}?export=1&enc=UTF-8&xf=csv');"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
XML :
<?xml version="1.0"?><Reward><Id>a04i000000AhEc8AAF</Id><Name>R-0001</Name><UserId>005i0000002hsAbAAI</UserId><TimeId>a01i000000AoSiWAAV</TimeId><RewardAmount>500</RewardAmount></Reward>
I have a VF page like the below one.Now when i am going to click on "OK" Button,i need to download that XML file and i need to insert that XML file in related Attachments.Any idea...
<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection collapsible="false">
<apex:outputText value="{!xmldata}" style="width:1000px;"></apex:outputText>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Back" onclick="window.top.close();"/>
<apex:commandButton value="OK" onclick="window.open('/{!recid}?export=1&enc=UTF-8&xf=csv');"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
XML :
<?xml version="1.0"?><Reward><Id>a04i000000AhEc8AAF</Id><Name>R-0001</Name><UserId>005i0000002hsAbAAI</UserId><TimeId>a01i000000AoSiWAAV</TimeId><RewardAmount>500</RewardAmount></Reward>
See the below thread for downloading the XML file,
https://developer.salesforce.com/forums?id=906F000000098gWIAQ
See the below thread for adding the File to the Attachments,
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009Fq0IAE
Regards,
Ashish