Populate the custom field with the extracted value from the email body

Since JEMH 3.1.15

Scenario

When the given email being received and contains the text/calendar part, which is encoded and the required information is hidden inside. You want to extract the desired value and populate in the custom field. This example includes the use of regular expressions to extract values from the email and populate the corresponding custom field.

// to get the calendar data var calendar = jemhUtils.getCalData(); // create regexp pattern to extract the value from the Calendar - Location field, which is hidden inside the encoded part var pattern = Java.type("java.util.regex.Pattern").compile("Phone\\sNumber\\s?([0-9]+)\\sPIN\\s?([0-9]+)#"); var matcher = pattern.matcher(calendar); // if able to extract Location value, assign it to a group and populate the custom field ("Location") if (matcher.find()) { var group = matcher.group(0); if (group) { resultMap.put("Location",group); } }