Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Extract email from sc_task work notes

eduardosant
Giga Contributor

Hello community, I'm trying to create a flow to automate emails. In the "to" field of the action available through Service Now, I managed to create a script to extract the "description" field. However, I need to do the same for "work notes", but I was unsuccessful. I need help and creativity on how to perform this task.

Below is the script I created to extract the email in the "to" field.

 

 

// Get the description of the trigger record
var description = fd_data.trigger.current.description;

// Regex to extract email
var emailRegex = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/;

// Search by email
var match = description.match(emailRegex);

// Returns the found email or empty string
if (match) {
return match[0];
} else {
return '';
}
3 REPLIES 3

YaswanthKurre
Tera Guru

HI @eduardosant ,

 

What exactly is your issue, are you not able to get the work notes from flow script ?

 

Thanks,

Yaswanth.

Hello yASWANTHkURRE, I'm not able to transform work notes into the "string" type. 

Hello @eduardosant ,

 

Are you using "fd_data.trigger.current.work_notes.toString()"? for all the work notes on current record

 

or you only need the recently added worknotes?

 

Thanks,

Yaswanth