- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 04:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 06:55 AM
Hi Sandeep,
onCellEdit is a function that is used in the case of a list. If you want to write some script that should be executed on a list then you can do that by using onCellEdit function.
In my previous example:
It is checking in one field whether it is having the same old value or new value and if success then returns a success using the callback function.
Another small example for you:
The script below runs on the State field and prevents users from changing the State to closed in a list. Hope this helps.
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if(newValue == 7){
alert('Not allowed');
saveAndClose = false;
} else {
saveAndClose = true;
}
callback(saveAndClose);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 06:55 AM
Hi Sandeep,
onCellEdit is a function that is used in the case of a list. If you want to write some script that should be executed on a list then you can do that by using onCellEdit function.
In my previous example:
It is checking in one field whether it is having the same old value or new value and if success then returns a success using the callback function.
Another small example for you:
The script below runs on the State field and prevents users from changing the State to closed in a list. Hope this helps.
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if(newValue == 7){
alert('Not allowed');
saveAndClose = false;
} else {
saveAndClose = true;
}
callback(saveAndClose);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 07:32 AM
Thank you ajay
i understood client script.
but i am not getting this list part how to configure ...and the on change which filed we have to run that ..
as you said "" The script below runs on the State field and prevents users from changing the State to closed in a list""
then for this state field how we are fetching value ..
please help me in this ..
Thanks
Sandeep Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 07:37 AM
You will be using oncelledit also in the similar way like an onchange to work with some field value.
So in my previous example that field is state.In incidents and all state field will be having a value right.It is checking that value from the list with the one I have given in the script that is '7' and preventing users from changing the State to closed in a list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 07:42 AM
so it is like we can have our drop down with some value in that ..let suppose
a
b
c
d
so to prevent user to enter value d we can write client script like
if(newValue == 4){
alert('Not allowed');
saveAndClose = false;
am i right ?
this is what we call creating a list ...example like dropdown?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 07:51 AM
If your field value is d then
if(newValue == 'd'){
alert('Not allowed');
saveAndClose = false;
This will make sure that the field is not editable if value is 'd'.
Below link also will be helpful for you.
how do i remove status values closed and resolved from list edit.