- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 12:53 PM
I want to use onCellEdit client script to be executed on editing a particular field on form. But its not working. My client script is very simple & straight forward as given below:
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
alert('Cell edit CS called...');
callback(saveAndClose);
}
Any help is appreciated. Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 12:57 PM
Yes, it appears so based on the documentation:
You should be able to accomplish what you need on the form using an 'onChange' client script.
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 12:57 PM
Yes, it appears so based on the documentation:
You should be able to accomplish what you need on the form using an 'onChange' client script.
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:54 PM
Hi Ajit,
onCellEdit is used when values are changed in list view and not in form view. For validating a field in form view ,use script like onChange, onload or onSubmit.
Please mark this post Helpful, Like it, or mark as the Correct Answer where applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:58 PM
Hi Ajit,
as your script, it wont work on form,
you can use onSubmit,
onCellEdit will work only on list view while change the values in a list.
Regards
Bitra.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 09:00 PM
Hello Ajit,
On cellEdit will execute in the list level only and you can write on a partcular field.
Scripts can be defined as onCellEdit to run on the client side when the list editor interacts with a cell.
Note: onCellEdit scripts do not apply to list widgets on homepages or dashboards. |
An onCellEdit() script must contain a function named onCellEdit().
An onCellEdit() script takes the following parameters:
- sysIDs - An array of the sys_ids for all items being edited.
- table - The table of the items being edited.
- oldValues - The old values of the cells being edited.
- newValue - The new value for the cells being edited.
- callback - A callback that continues the execution of any other related cell edit scripts. If 'true' is passed as a parameter, the other scripts are executed or the change is committed if there are no more scripts. If 'false' is passed as a parameter, any further scripts are not executed and the change is not committed.
.
ServiceNow Commnunity MVP -2018 class.