How to get the comment that starts with a particular string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 07:40 AM
Hi all,
I have a requirement where I have to get the specific comment from RITM to catalog task that is created after approval.
I am handling it from the flow but it is not working as expected. I have to only get the comment that starts a particular string 'comment from approval note', but here I am getting the entire list of comments. Can anyone tell me how to get that comment that starts with a particular string, thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 01:52 AM
Can you try this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 08:17 AM - edited 11-10-2022 08:18 AM
Hi @Bindhu1
getJournalEntry(-1) means you get ALL comments.
The IF only checks if in ALL comments you find "comment from approval note", which you do on your tests.
Finally you are return com, which is ALL comments again.
Do this:
- Get ALL comments into a string
- Then store each comment on an array
- Then evaluate each and return the one you want.
//gets all journal entries as a string where each entry is delimited by '\n\n'
var notes = current.work_notes.getJournalEntry(-1);
//stores each entry into an array of strings
var na = notes.split("\n\n");
for (var i = 0; i < na.length; i++)
gs.print(na[i]);
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 04:54 AM
Hello @Bindhu1,
Your code should be comments.getJournalEntry(-1).split(‘\n’)[1] to get specific string value.