- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 01:36 AM
Hi,
Please advise how to split the sentence when ends with dot(.) while doing the update into customized field 'issues' column.
THanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 02:16 AM
something like this in business rule (Before insert/update)
// Get the current issues string
var issuesString = current.u_issues + '';
// Split by period
var issuesArray = issuesString.split('.');
// Prepare a new array for cleaned sentences
var cleanedIssues = [];
for (var i = 0; i < issuesArray.length; i++) {
var issue = issuesArray[i].trim();
if (issue) {
cleanedIssues.push(issue + '.'); // Add the period back if you want
}
}
// Join with newline character
current.u_issues = cleanedIssues.join('\n\n');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 02:16 AM
something like this in business rule (Before insert/update)
// Get the current issues string
var issuesString = current.u_issues + '';
// Split by period
var issuesArray = issuesString.split('.');
// Prepare a new array for cleaned sentences
var cleanedIssues = [];
for (var i = 0; i < issuesArray.length; i++) {
var issue = issuesArray[i].trim();
if (issue) {
cleanedIssues.push(issue + '.'); // Add the period back if you want
}
}
// Join with newline character
current.u_issues = cleanedIssues.join('\n\n');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 06:30 AM
Hi Ankur,
Please let me know is there any different approach instead of splitting by (.).