Are onCellEdit client scripts only applicable for list view?

ajitmundhekar
Tera Expert

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!

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Yes, it appears so based on the documentation:



Client script types



You should be able to accomplish what you need on the form using an 'onChange' client script.



Cheers,



Tim


View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Yes, it appears so based on the documentation:



Client script types



You should be able to accomplish what you need on the form using an 'onChange' client script.



Cheers,



Tim


nitdubey
Kilo Expert

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!


Srvs
Kilo Guru

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.


Karthik Reddy T
Kilo Sage

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


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.


Client scripts


.


Karthik Reddy T.
ServiceNow Commnunity MVP -2018 class.