- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 05:35 AM
Hi,
I'm doing a query from an IF statement workflow to get information from RTIM notes activities.
The script script is working but I would like to be able to query only the last activity (most recent).
The reason is in some cases, the workflow will need to loop back and will need to redo a query in the note activities and it will require to see the lastest activity recorded.
Thanks in advance for your help
-----
answer = ifScript();
function ifScript() {
var notes = current.work_notes.getJournalEntry(-1);
if (notes.toLowerCase().indexOf("please extend expiry date") > -1){
return 'yes';
}
if (notes.toLowerCase().indexOf("please deactivate/withdraw") > -1){
return 'no';
}
}
-----
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 05:45 AM
getJournalEntry(Number mostRecent)
mostRecent | Number | If 1, returns the most recent entry. If -1, returns all journal entries. |
current.work_notes.getJournalEntry(-1);
current.work_notes.getJournalEntry(1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 05:52 AM
You need to replace -1 with 1
var notes = current.work_notes.getJournalEntry(1);
-1 fetches all entries whereas 1 fetches the latest one.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 05:51 AM
Just put a 1 instead of -1. That will get you the last work_note from the journal entry.
-1 gets you all entries.
var notes = current.work_notes.getJournalEntry(1);
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
‎12-08-2022 06:04 AM
Take a look at this great email script out of the box example (just add this to your instance prefix): /sys_script_email.do?sys_id=44f4bd7db7522300bc1308a9ee11a933
They get the last comment and split the array in all the elements (text, timestamp, user). The .shift() removes the first element (the text written) from the array since they want to use it to communicate the reject notes.
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
‎12-08-2022 05:52 AM
You need to replace -1 with 1
var notes = current.work_notes.getJournalEntry(1);
-1 fetches all entries whereas 1 fetches the latest one.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023