UI Action g_modal

anas_m
Tera Contributor

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

2 REPLIES 2

anas_m
Tera Contributor

Hi,

 

Could someone help ?

 

Thanks 

NoBert
Tera Contributor

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