- 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 08:03 AM
but in your example you have taken value 7 ...why that ..is it something like we have some value for one value in list ....
and this preventing user to enter specific value ...can achieve with onChange Scripts also then why only cellEdit.
One more doubt i have in this ......
will it work in case of list only or we can have this on text box also ..
like
if i want run celledit script ..when i am running this client script ..it should check whether i am entering correct value or not ..
Thank you
Sandeep Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2016 10:45 PM
I will explain.
Go to some incident and right click state field and select configure dictionary.Then you can see the choice values for the field as choices .If you look at that you can see 2 fields for each choice ,One as value and other as label.
Label is the value that will be displayed to the user whereas value will used in our scripts. So here I have used the value for the option closed.(here Value is 7 and label is closed). Hope this makes it clear for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 09:46 PM
Hi Ajai,
I have done same as you have asked ...but still its not working ..i am sending you details what i did .
This is the table i have created ..
Choice Field label and value both are same in my case .
and the cellEdit client script is below...which run on cellEdit of cell field of table.
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if(newValue == "test2")
{
alert("Not allowed");
saveAndClose = false;
}
else
{
saveAndClose = true;
}
callback(saveAndClose);
}
Can you please help me in this ..?
Thanks
Sandeep Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 11:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 11:33 PM
yeah Ajai its working ..
but here i have one doubt..
when i am choosing value first time from UI its allowing me but when i am changing value after inserting value in table its not allowing me ..
why it is like that?
is it like when we want to stop end user from inserting specific value ..we have to use on change script.