You need to sign in to do that
Don't have an account?
How to download a csvBlob?
I have created a csvBlob that contains user records,
Can someone please tell me how to download that file?
Thanks
Here is the code:
public with sharing class Send_noti_emails {
public PageReference download_csv() {
string header = 'Record Id, Name , First Name , Last Name , Email, Qulification\n';
string finalstr = header ;
string recordString;
for (Inquery__c inquery: [SELECT Email__c,First_Name__c, Last_Name__c,Quilification__c FROM Inquery__c WHERE Download__c = False]){
recordString = inquery.id+','+inquery.First_Name__c+','+inquery.Last_Name__c+','+inquery.Email__c +','+inquery.Quilification__c +'\n';
finalstr = finalstr +recordString;
}
blob csvBlob = Blob.valueOf(finalstr);
return null;
}
}
Hi,
if you are not particular about Blob, here is an example of how to generate a .CSV file:
https://gist.github.com/tyoshikawa1106/5511623
Yes i have done it this way before,
But i want a Bttn to call an APEX code,
I don't want it to be called in a VisualForce page,
It looks much more professional that way,
Thanks for your help,
Best,