Extract a String from the Subject line in the Inbound Email Action.

Vidya Lakshmi
Kilo Sage
Kilo Sage

Hi All,

Please let me know how to extract the data from the Subject line of the Email in Inbound Email Action.

Subject  : VMM - 0000307658 - 0180

We need to extract 0000307658 and 0180 from the above subject line.

Kindly help me as to how to extract the data from the above String value.

Regards,

R Vidya Lakshmi.

 

7 REPLIES 7

suvro
Mega Sage
Mega Sage

var subArr= email.subject.split('-');

var part1 = subArr[1];

var part2 = subArr[2];

Chandu Telu
Tera Guru
Tera Guru

Hi Vidya,

May i know your exact requirement it can achieved in multiple ways

As @survo mentioned method you will get the 2 strings after "-" 

 

EX:  "VMM - abc0000307658 - test0180"

Answer: abc0000307658test0180

 

In my senario you will get only numbers in that string

var test =email.subject.replace(/\D/g,"")

find_real_file.png

 

find_real_file.png 

 

Thanks
Chandu Telu
Please Mark ✅ Correct/helpful, if applicable,

I think you are confusing the seeker with representing my solution in a wrong way. I would request you to refrain from such kind of activities and focus on your solutions and let the user decide which solution suits them better

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Are you sure the data to be extracted will be at that position only in the string?

what if the format is not the same always? then string manipulation won't work

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader