Restrict additional comments field to accept only 4000 characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:03 AM
Hi Team,
The requirement is to restrict the additional comments(Journal Input - field type) field to accept only 4000 characters on case record. Can anyone please help me how to achieve this requirement. Thanks in advance. I have written onChange client script on case table,
Script: //testing purpose I'm trying to restrict 4 characters only
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var v_comments = g_form.getValue('comments');
var count = v_comments.length;
if (count > 5) {
alert("No.of characters " + count);
g_form.setValue('comments', v_comments.substring(0, 4));
}
}
still it is allowing to enter 5th character but the requirement is to stop allowing the 5th character.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 07:43 AM
HI @Jaspal Singh ,
1)After entering 5th character , If I click on post option the comments are posting - need to restrict this
2) but if I enter 6th character then 5th & 6th characters are deleting and showing 4 characters only in target field.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 09:11 AM
In that case, you need a Before Insert BR on the sys_journal_field table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 09:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 09:26 AM
(function executeRule(current, previous /*null when async*/ ) {
var v_comments = current.comments;
var count = v_comments.length;
if (count > 5) {
gs.addErrorMessage("No.of characters " + count);
current.comments=v_comments.substring(0, 4);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 11:38 PM