- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 05:59 AM
What is the Maximum Lines of Code allowed for a single Script Include ?
I am not have much luck finding any article that provides a hard and fast maximum limit to the number of lines of JavaScript that a Script Include can have.
I have about 3 thousand lines of Javascript spread across three subflows (Script Activities) and a few Server Side Script Includes.
I would like to move all of my JavaScript from the Script Activities and move them to Script Includes. There are details as to why I am doing this.. but it beyond the context of the question. For the moment, I have to put all of the code into one Script Include (if possible).
Is there a limit to how much code Service Now will allow per Script Include ?
Personally and Professionally, I would prefer things broken down into many smaller Script Includes.. but for the moment,, I have been out-voted. Will keep fighting the good fight.
In the mean time.. I would like to know what the Best Practice / Hard limit (if any) is on the number of lines of code per Script Include.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 07:30 AM
Good call and I stand humbly corrected. I didn't realize that anything over 255 characters is basically unlimited.
Seems like it's related to the way the field is converted to a data type in the database when it is created.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0685779
Looks like there IS a limit, but it is such that you would find it difficult reach!
Any string field that is larger than varchar(255) is given the mediumtext data type. In the client, it will be represented as HTML textarea, instead of an HTML input. The maximum length of mediumtext is 16,777,215 bytes.
Thats about, oh, 250 books worth of storage in a single field!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 06:14 AM
Hi Chris,
As such there is no limit on the number of line of codes. But I would recommend to have it within some limit
so that it becomes easier to maintain or debug in future
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 06:31 AM
Hi Chris,
I am glad to hear the comment has helped.
Saying this, I will appreciate if you close this thread, as answered.
Have a great rest of the day
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader