Replicate logic on onCellEdit Client Script

Elena Pomana
Tera Guru

Hello,

 

I have an OnChange client script is to make the user apply certain formats in a decimal field. This is the script and it works.

find_real_file.png

I want to have the same functionality in a related list. 

What is the best approach to do it? A OnCellEdit client script or maybe a Business Rule?

 

Thank you,

Elena

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You are on right track.

You can either use onCell Edit client script OR Before Update Business rule on that related list table

It now depends how the customer wants to see the error message since field message won't be working in onCell client script

Regards
Ankur

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You are on right track.

You can either use onCell Edit client script OR Before Update Business rule on that related list table

It now depends how the customer wants to see the error message since field message won't be working in onCell client script

Regards
Ankur

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

Hey,

 

I did the same thing in an onCellEdit client script but regex doesn't work. It lets me put any values in the field, that is weird.

In the end I think I will use a BR for the related list, to have the error message.

I wanted to know if that's the right track or if there are better ideas.

 

Thank you for the answer,

Elena

 

Hi,

if the above client script is working fine then it should work fine in onCell Edit as well

You can use a business rule and show error message as good user experience.

If you use onCell Edit you can only show alert which is not a good user experience.

Regards
Ankur

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

@Elena Pomana 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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