UI Action g_modal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 07:23 AM
Hello ServiceNow Community,
I have a concern with g_modal, when the window is triggered, the page gets refreshed and the status of incident changes to Confirmed As Major Incident. My problem is that the user doesn't even have time to add some info like Responsible and Work notes. Could you please help ?
Please find below my UI Action Workspace script
function onClick(g_form) {
var fields = [{
type: 'reference',
name: 'u_resp',
label: getMessage('Responsible'),
mandatory: true,
reference: 'sys_user',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue(),
displayValue: g_form.getDisplayValue()
},
{
type: 'textarea',
name: 'work_notes',
label: getMessage('Work notes'),
mandatory: true,
}
];
//open the popup
g_modal.showFields({
title: "Promote to Major Incident",
fields: fields,
size: "lg"
}).then(function(fieldValues) {
g_form.setValue('u_resp', fieldValues.updatedFields[0].value);
g_form.setValue('work_notes', fieldValues.UpdatedFields[1].value);
});
g_form.submit(g_form.getActionName());
}
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 06:47 AM
Hi,
Could someone help ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 06:30 AM
Hi anas_m,
You script looks good to me. I am using more or less the same code. The only difference is in your last line, where I use
g_form.save();
instead of
g_form.submit(g_form.getActionName());
Maybe it's worth to give it a try.
Regards,
Norbert