
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 05:29 AM
HI All,
I have written a on CellEdit client script on incident table, when ever close notes is empty and close code is none, then it should not allow to closed the incident from the list view even. It is preventing incident closure but how to show an error message or alert to the user on the scrren.
My code:
Table: Incident
Field:State
Script:
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
var closeCode = g_form.getValue('close_code');
var closeNotes = g_form.getValue('close_notes');
if(closeCode == none || closeNotes == '' && oldValue != 3 && newValue == 3)
{
alert("Close the notes and code first");
saveAndClose = false;
}
else
{
saveAndClose = true;
}
callback(saveAndClose);
}
I am not able to see the Alert message
Can some one correct my code plz
Regards,
Indup
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 05:49 AM
Hi Indup,
I don't think you can access g_form operations from the list view. I would recommend switching to Before business rule to handle the validation and to abort the action.
- Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 05:56 AM
HI Pradeep,
I have written Before BR on Update,
When to Run:
before : update
state changes to Closed
Script:
if(current.close_notes == '' || current.close_code == none)
{
gs.addInfoMessage("Close Notes and CLose Code need not be empty before Closure");
}
But even now it is not showing info message on incident list
Regards
Indup

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 06:33 AM
Updated script below.
if(current.close_notes == '' || current.close_code == '')
{
gs.addInfoMessage("Close Notes and CLose Code need not be empty before Closure");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 06:00 AM
g_form works on the form.
it will not work in the list . you can switch it to before business rule and add the filter condition
and then in action tab set the message .