- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 09:27 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 10:56 PM
Please close this question by marking my response as correct solution so that it will be helpful for future users to find correct solution.
Happy Learning 🙂
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 09:34 PM
Hello @mounika32
You can write a Client Script for the Same :-
suppose your multi-line field is string :-
function onLoad(){
var desc = g_form.getValue('description');
var arr = desc.split('\n');
var count=0;
for(var i=0;i<arr.length;i++){
count++:
}
alert("Number of Lines are" +count);
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 09:46 PM - edited ‎12-06-2023 09:47 PM
Hi @mounika32 ,
// Replace 'your_table_name' and 'your_multi_line_text_field' with your actual table name and field name
var tableName = 'your_table_name';
var fieldName = 'your_multi_line_text_field';
// Get the record with the desired multi-line text field
var gr = new GlideRecord(tableName);
gr.addQuery('sys_id', 'your_record_sys_id'); // Replace with the actual sys_id of your record
gr.query();
if (gr.next()) {
// Get the multi-line text field value
var multiLineText = gr.getValue(fieldName);
// Split the text into an array of lines
var linesArray = multiLineText.split('\n');
// Get the count of lines
var linesCount = linesArray.length;
gs.info('Number of lines in ' + fieldName + ': ' + linesCount);
} else {
gs.error('Record not found');
}
This script assumes you have the sys_id of the record you're interested in, and it fetches the multi-line text field's value using getValue. It then splits the text using the newline character (\n) and calculates the count of lines.
Adjust the script according to your specific use case and field names.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 09:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 10:15 PM
Try the .length in a new line then check if it returns proper value or not
var linesArray = itar.split('\n');
// Get the count of lines
var linesCount = linesArray.length;
Thanks,
Danish