
- 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:45 AM
Hi,
Nothing wrong with the script & use of alert. Can you make sure pop-up blocker or not pop-up is not configured for your browser. Alternatively, check in different browser as well.
Thanks,
Jaspal Singh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 05:50 AM
HI Jaspal,
I tested in mozilla and chrome as well. But alert is not showing. But it is preventing incident closure. I need alert message. SO what is wrong here
Regards,
Indup

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 05:55 AM
In that case as Pradeep suggested, better switch to Business rule that runs before update & aborts actions if fields are missing with required set of Error messages using gs.addErrorMessage().
Thanks,
Jaspal Singh

- 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