Add a character limit on a variable from a record producer

cloprea
Tera Contributor

Hello,

 

I would need to set a 350 words character limit on a variable from a record producer while filling in the form in the portal. 

 

I found multiple solutions suggesting client scripts. Is there a way to fulfil this without scripting?

 

Thanks in advance!

4 REPLIES 4

Adrian Ubeda
Mega Sage

Hello @cloprea , 
Inside type specifications you can use validation regex for this use case. You can create your own regex and then use it where needed. Service Catalog > Catalog Variables > Variable Validation Regex

 

Check this support link:
https://www.servicenow.com/community/developer-articles/regexes-for-catalog-items-variable-validatio...

If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆

Brad Bowman
Kilo Patron

350 words is not a character limit.  You can limit a variable to 350 (or whatever number) characters by using a Variable attribute: max_length=350

BradBowman_0-1768918037907.png

 

Ankur Bawiskar
Tera Patron

@cloprea 

if it's single line text variable then approach from @Brad Bowman  will work

Set the maximum character length for variables of single-line text or wide single line-text in Servi... 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

M Iftikhar
Tera Sage

Hi @cloprea,

 

You can use the variable attribute "max_length" to limit the number of characters, for example "max_length=200".

MIftikhar_0-1768918464567.png

MIftikhar_1-1768918486011.png

 

If my response helped, please mark it as the accepted solution so others can benefit as well.



Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.