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

The format is going to remain the same and there will be no changes to the format.

Hi,

then I would suggest to use RegEx to extract the value instead of string manipulation

var str = 'VMM - 0000307658 - 0180';

var val = str.match(/\b([0-9]{10})/);

gs.info(val[0]);

Regards
Ankur

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

Hi Vidya,

If your requirement is completed make the correct answer(Which you have used), So it will help others to use future.

if you format won't change then @suvro given answer is also right.

 

Thanks

Chandu Telu