Set Character limit on Multi-line Variables for 4 variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Set Character limit on Multi-line Variables for 4 variables : We have 4 different variables in a catalog form where we have to set limit for them for eg : Description(400), Name(250), Stock(350), Lines(380) how to achieve this pls let me know with less code and as per the best practise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LearnerSN,
If you are doing onChange client script, then you need one Client script for each.
If this response resolved your issue, please consider marking it as Helpful and accepting it as the Solution. Your feedback helps other ServiceNow Community members find reliable answers.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
ok can we do it one catalog cleint script, what is the way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
No, you cant do with only one client script. Each field needs its separate validation, its dependent on itself, there is no issue in doing 4 client scripts.
There is an alternative to it if you dont want that much client scripts.
Go to All > Variable Validation Regex
Create a new record
400 char limit
Add this in regex: ^[\s\S]{0,400}$
Add Validation message: Input is exceeding 400 characters
Save the record.
In the variable record, go to Type Specifications section > Validation Regex field, add this Validation Regex you created.
No script needed, it will validate 400 character limit.
If this response resolved your issue, please consider marking it as Helpful and accepting it as the Solution. Your feedback helps other ServiceNow Community members find reliable answers.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LearnerSN
Could you please confirm, post setting 4 variables in the multiline variable , is that multi-line variable would be ReadOnly?
If that is the case , you can validate length for each 4 variable using onChange client scripts and then set the value to Multiline variable.
Is your requirement includes Multiline variable should be editable ? In that case you