Client Scripts

Ashok  kumar
Tera Contributor

HI , I have one requirement . can anyone please help , Thanks in advance 

  I have a field named  short_description and description

 . write a client script to limit short description field to 30 characters , description field to 70 characters in the incident form 

2 ACCEPTED SOLUTIONS

Your error message already gives you the cause of the error: you have existing records that have data in them that exceeds the new length.

Personally, I'm more curious about why you want to limit (especially the description field) to such a length? You will have a lot of complaints about people being unable to fill in the data they need (let alone integrations and such). 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

Dr Atul G- LNG
Tera Patron
Tera Patron

We can use client script, but why you write a code mate, when it can be achived OOTB.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

7 REPLIES 7

Ashok  kumar
Tera Contributor

instead of it can we write a client script to limit , If yes please help how to proceed with client script 

 

This might work, but why limit it via client script, when you can do it on the dictionary level?

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') 
   {
      return;
   }
   if(newValue.length>70) 
   {
      g_form.showErrorBox("description","You cannot enter more than 70 characters",true);
   }
}

Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Dr Atul G- LNG
Tera Patron
Tera Patron

We can use client script, but why you write a code mate, when it can be achived OOTB.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************