The CreatorCon Call for Content is officially open! Get started here.

Will AddOption/RemoveOption work onCellEdit client script?

tahnalos
Kilo Sage

Per requirements, I had made some changes to a drop down field including adding more options.  Depending on the value of another field on the record, only certain options are visible to the user.  This was accomplished with an onLoad client script.

Can this also be done on an onCellEdit as well?  I tried to copy the relevant code onto such script but it doesn't appear to be working.

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I believe those are only available on the form view. The dropdown for a field when you're list editing wouldn't exist until you doubleclick into the cell to list edit.

View solution in original post

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I believe those are only available on the form view. The dropdown for a field when you're list editing wouldn't exist until you doubleclick into the cell to list edit.

Is there any way to customize the list view of the field to show selected values depending on a field parameter?

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Not that I know of from a dropdown. If this was a reference field you'd have more options from the list view.

sachin_namjoshi
Kilo Patron
Kilo Patron

you will have to configure onchange client script for onCellEdit()  function.

Following objects are available for onchange client script for onCellEdit() function

 

  • 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.

 

Regards,

Sachin