How to display a pop up with field when we click on ui action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 03:21 AM
Hi All,
Actually we have requirement that, basically on the catalog task in workspace we need a ui action "Ask approval" when we click on that need to display a pop with Approver field ,Actually already we have approver field on catalog task form , so we need to display that field on pop up , when we we select approver and click on , ok, then it needs to update that field with approver
Please help me to achieve this
Thanks
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 05:00 AM
then when they select the approver on popup it should send an approval to that user?
if yes then you can use UI page and invoke it from UI action in workspace
How to use UI Actions in Workspaces
there is a syntax to open UI page
this is the syntax
var ui_page_id = '<sys_id_of_your_ui_page>';
g_modal.showFrame({
url: '/ui_page.do?sys_id=' + ui_page_id,
title: 'Choose a template',
size: 'xl',
height: 500
});
reference: UI page on Agent workspace
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 02:08 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2025 10:37 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 10:34 PM - edited 03-05-2025 10:42 PM
Hi @Deepika61,
Use the below code in Workspace client script in UI Action :
Name - Ask Approval
Script -
function onClick(g_form){
g_modal.showFields({
title: "Approver",
fields: [{
type: 'reference',
name: 'approver',
label: getMessage('Approver'),
mandatory: true,
reference: 'sys_user', // reference table of the approver field
referringTable: 'sc_task' // table on which ui action is visible
}, ],
size: 'md'
}).then(function(fieldValues) {
g_form.setValue('approver', fieldValues.updatedFields[0].value); // first string to be the backend value of approver field on sc_Task
g_form.save();
});
}
Regards
Shivani