How to download entire record as csv file to local machine

____39
Tera Contributor

Hi, I want to use UI action to achieving download current record of my crated table, Below is my script, this function only can download listlayout selected fields information, Do you have any solution to download entire record no matter what I selected fields in Listlayout? Thank you!

 

function Download(){

 

var recordSysId = g_form.getUniqueValue();

 

var tableName = g_form.getTableName();

top.window.open('/' + tableName + '.do?CSV&sys_id='+recordSysId);

 

1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

Hi,

You can create new LIST view and add all columns into that view.

Then update your UI Action script like below:

function Download(){ 
var recordSysId = g_form.getUniqueValue(); 
var tableName = g_form.getTableName();
top.window.open('/' + tableName + '.do?CSV&sys_id='+recordSysId+'&sysparm_view=exportcsv&view=exportcsv');  // replace name of your new view here
}

 

Thanks,

Anil Lande

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

4 REPLIES 4

Anil Lande
Kilo Patron

Hi,

You can create new LIST view and add all columns into that view.

Then update your UI Action script like below:

function Download(){ 
var recordSysId = g_form.getUniqueValue(); 
var tableName = g_form.getTableName();
top.window.open('/' + tableName + '.do?CSV&sys_id='+recordSysId+'&sysparm_view=exportcsv&view=exportcsv');  // replace name of your new view here
}

 

Thanks,

Anil Lande

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Thank you! It Worked, But in the downloaed file, u_type field did not recognize Jananese, Do you Know why? Thank you!

Hi,

Not sure, as this is OOB functionality and exporting data into CSV might not consider Multilanguage data. Or it maybe because of application in which you are trying to view CSV file (local application) 

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Glad to know provided solution worked for you. If your actual issue is resolved then you can close this question by marking appropriate response as correct.

Happy Learning 🙂

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande