Is it possible to update the fields value based on other fields value change using onCellEdit() client script?

Tejaswini Moha1
Kilo Contributor

Hi all,

I have i doubt, can we change the value of some field based on other field value change using oncellEdit() client script?

For example, if i change the value in short description, can i add old short description to description.. such kind of senario is possible using onCellEdit()?

 

Thanks and regards,

Tejaswini.

1 ACCEPTED SOLUTION

Ganesh Pardhe
Kilo Guru

Hello Tejaswini,

check below screen shots for client script and script include to achieve the requirement. 

Client script:-

find_real_file.png

Script Include:-

find_real_file.png

Please mark helpful and correct if my answer is worthy.

Thanks and regards

Ganesh

View solution in original post

6 REPLIES 6

adriantoth
Tera Contributor

Hi Tejaswini,

 

in general, you may want to use the setValue method of GlideForm:

https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideFormSetValue_String_String

 

The oldValues parameter of the onCellEdit method contains the previous values of the field being edited.

https://docs.servicenow.com/bundle/helsinki-application-development/page/script/client-scripts/refer...

 

Does this help?

Hi Adriantoth,

Thank you for the reply.

I tried with GlideForm setValue(), but it is not working as the method works on form view.

Regards,

Tejaswini.

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Tejaswini,

Very less documentation is available for onCellEdit

better for such type of scenario use before update business rule it would work when you edit something in list as well

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Thank you for the reply. this was helpful.

Regards,

Tejaswini.