- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 02:24 AM
Hello Everyone,
How to get variable value from the RITM work note.
We have more than 10 values in the RITM work note but I need only two values in the notification. like below
DSF: dsf value
Mount: mount value.
How to achieve this please suggest me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 03:03 AM
okay got it, I assume your email script and notification is on sc_req_item table
use this email script to extract only those 2 values
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var workNotes = current.work_notes.getJournalEntry(1); // Get the latest work note
var dsfValue = '';
var mountValue = '';
// Extract DSF and Mount values
var lines = workNotes.split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith('DSF:')) {
dsfValue = lines[i].substring(4).trim();
} else if (lines[i].startsWith('Mount:')) {
mountValue = lines[i].substring(6).trim();
}
}
template.print('DSF: ' + dsfValue + '<br/>Mount: ' + mountValue);
})(current, template, email, email_action, event);
I was able to extract it in background script, so It should work for you as well in email script
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
‎04-07-2025 02:38 AM
so in RITM work notes variable values are entered and you need to get only variable value?
Is DSF and Mount variable label in below? Share some screenshots
in which script you want to do this? business rule etc?
DSF: dsf value
Mount: mount value.
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
‎04-07-2025 02:51 AM
@Ankur Bawiskar
Please find below attached RItm's work note screen shot.
I need only DFS Name and Share Name from the work note. I am using email script for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 03:03 AM
okay got it, I assume your email script and notification is on sc_req_item table
use this email script to extract only those 2 values
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var workNotes = current.work_notes.getJournalEntry(1); // Get the latest work note
var dsfValue = '';
var mountValue = '';
// Extract DSF and Mount values
var lines = workNotes.split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith('DSF:')) {
dsfValue = lines[i].substring(4).trim();
} else if (lines[i].startsWith('Mount:')) {
mountValue = lines[i].substring(6).trim();
}
}
template.print('DSF: ' + dsfValue + '<br/>Mount: ' + mountValue);
})(current, template, email, email_action, event);
I was able to extract it in background script, so It should work for you as well in email script
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
‎04-07-2025 04:33 AM
Thank you @Ankur Bawiskar