- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 08:06 AM
I want to get the rejected comment only as the subject line but not all comments
Solved! Go to Solution.
- Labels:
-
Project Portfolio Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 07:14 PM
you need to remove that timestamp like this
var value = current.comments.getJournalEntry(1);
var str = value.split(' - ')[1];
var name = str.split(') ')[0] + ')';
var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;
gs.info(name);
var onlyComments = value.replace(dateRE, '');
template.print('Rejection comments' + onlyComments);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 01:42 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers..!
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2022 09:14 PM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers..!
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 10:15 AM
Hi,
Try the below code
var latestComments = current.comments.getJournalEntry(1):
// In my case journal entry looks like this "2022-02-21 System Administrator (Additional Comments) request has been rejected"
var splitComments = latestComments.split('(Additional Comments)');
var getComments = splitComments[1]; // request has been rejected
template.print(getComments);