convert UI Action to List Action in Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
I created a UI Action on wm_task record that convert the form the pdf in a specific format and download the file to the login user computer.
Now I want to do the same Action but on a List so that the user can choose multiple records and click on the List UI Action and it will convert and download all the selected records.
This is my script of the record UI Action:
// Code Generated by Sidekick is for learning and experimentation purposes only.
var pdf = new sn_pdfgeneratorutils.PDFGenerationAPI();
var html;
var gr = new GlideRecord("wm_task");
if (gr.get(current.sys_id)) {
html = "<html><head><style>";
html += "body { direction: rtl; font-family: Arial, sans-serif; color: #111; margin: 0; padding: 0; }";
html += ".section { font-size: 16px; font-weight: bold; margin-top: 18px; margin-bottom: 6px; text-align: center; }";
html += ".field-line { font-size: 11px; margin-bottom: 4px; text-align: right; margin-right: 20px; font-weight: normal; }";
html += "</style></head><body>";
// פקודת עבודה section
html += '<div class="section">פקודת עבודה</div>';
html += fieldLine("מזהה פנייה", gr.work_order.number);
html += fieldLine("בר קוד מזהה פנייה", "");
html += fieldLine("קטגוריה", gr.work_order.u_category_order.title);
html += fieldLine("מהות הפנייה", gr.work_order.u_pnia);
html += fieldLine("תיאור הפנייה", gr.description);
html += fieldLine("תאריך ושעת פתיחה", gr.sys_created_on.getDisplayValue());
html += "</body></html>";
function fieldLine(label, val) {
return '<div class="field-line">' + label + ': ' + val + '</div>';
}
var result = pdf.convertToPDF(
html, 'wm_task', current.sys_id,
(gr.parent ? gr.parent.number : gr.number) + 'pdf'
);
if (result.status === 'success' && result.attachment_id) {
var downloadURL = '/sys_attachment.do?sys_id=' + result.attachment_id;
var gURL = new GlideURL(downloadURL);
// action.setRedirectURL(gURL);
gs.addInfoMessage("Success");
} else {
gs.addErrorMessage("Failed");
}
}
How can I adjust this script for the UI List action in Workspace:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
the script you shared and the one in screenshot is different
which one is the current one?
check if this helps
UI Builder : List Action | Export only Selected Items From List
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
see this blog and it uses client side list action, you can enhance it for your case
Exploring List Actions in Workspace Experience (UI Builder)
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
