Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Parse Email subject via flow designer

TylerJ333505898
Tera Contributor

Is there a way i can use flow designer to parse the email subject? 

I have a inbound email triggering a flow based on sender and subject. This flow should submit a catalog item with different values from the subject into different variables. the body of the email does not show the values as its in a image and the only way i cant think of is via the subject. 

 

Currently the subject contains this:   Approved: Termination for John Smith, 123456 (2026-07-05)

I have three variables on a catalog item that are the below 

User Being Termed: (I would like it to show john smith)

Employee Number: (should be the 123456 above) 

 

Term Date: (Should be date in () (2026-07-05)

is this possible to do via flow designer? if so any pointers in how to would be helpful. 

1 REPLY 1

MS25
Mega Sage

 

  • Use the Data Pill for the email subject, which is available in the Email object provided by the trigger.
  • Add a "Script" Action  to process the subject.


// Example: Extract a specific pattern (e.g., numbers) from the subject
var emailSubject = email.subject; // Get the email subject
var match = emailSubject.match(/\d+/); // Extract first numeric sequence
if (match) {
outputs.parsedValue = match[0]; // Output the extracted value
} else {
outputs.parsedValue = "No match found";
}

Add an output variable, e.g., parsedValue, to use the extracted data later in the flow.