- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 02:17 AM
Hi,
Regarding the CSV export function shown in the next image, where is this defined?
We need to create a new UIAction that includes CSV export functionality and would like to reference existing CSV export definitions, scripts, etc.
Please can someone help me out. Thank you in advance.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 04:34 AM
Hi Koki,
Filter on Name = "CSV" to find the csv export script. Unfortunately, it's calling internal Java class with GlideList2 as an argument. ContextMenuExportHandler() seems like it can be used in UI Action but since it's undocumented, it may be difficult to customize it.
FYI, the second argument 'unload_csv' can be switched to 'unload_xml' to export to xml, 'unload_json' to export to json. Seems like the syntax is 'unload_xxx' to export in xxx format.
/**
* Script executed on the Client for this menu action
*
* The following variables are available to the script:
* 'g_list' the GlideList2 that the script is running against (only valid for List context menus)
* 'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)
* 'g_sysId' the sys_id of the row or form that the script is running against
* 'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred
*/
runContextAction();
function runContextAction() {
var exportHandler = new ContextMenuExportHandler(g_list,'unload_csv');
exportHandler.exportRecords();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 02:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 04:34 AM
Hi Koki,
Filter on Name = "CSV" to find the csv export script. Unfortunately, it's calling internal Java class with GlideList2 as an argument. ContextMenuExportHandler() seems like it can be used in UI Action but since it's undocumented, it may be difficult to customize it.
FYI, the second argument 'unload_csv' can be switched to 'unload_xml' to export to xml, 'unload_json' to export to json. Seems like the syntax is 'unload_xxx' to export in xxx format.
/**
* Script executed on the Client for this menu action
*
* The following variables are available to the script:
* 'g_list' the GlideList2 that the script is running against (only valid for List context menus)
* 'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)
* 'g_sysId' the sys_id of the row or form that the script is running against
* 'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred
*/
runContextAction();
function runContextAction() {
var exportHandler = new ContextMenuExportHandler(g_list,'unload_csv');
exportHandler.exportRecords();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 11:03 PM
Thank you very much.
We will take this into consideration as a reference.