JEMH update summary field - no directives

Serge_tkint February 27, 2019

I may overlook the answer but I don't seem to find an example about this.

Question
a mail is processed (JEMH), but in a certain defined profile I want to change the summary field with something I extracted from the body. 

Technically:
I installed JEMH and already configured several profiles and scripts and more....

The mail is captured by the correct profile and with a regular expression I am filtering a custom field out of it , eg: MyField = 1234

But now I want that field to be added to the summary title of the new ticket to be created.
like:  summary = summary + " - " + MyField
Resulting in:  "This is the original title - 1234"

I found articles referring to directives like :  JEMH & directives

but I don't have (and don't want) those in my mail body because I already have my "Custom Field" with the content ready.

Is this possible?
thanks

1 answer

1 accepted

0 votes
Answer accepted
Mike Harrison _The Plugin People_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2019

Hello,

a mail is processed (JEMH), but in a certain defined profile I want to change the summary field with something I extracted from the body.

The Regexp Field Processor could be used to extract content from the email body, and then set the summary with that content.

Here is an example configuration (ignore the error message at the top - its a known bug!):

CUzU8y79jT.png

the regular expression (regexp) used will of course need to match the content in the email that you want to use in the summary!

Serge_tkint February 27, 2019

Hi Mike, yes that's where I am stranded.
I have that regular expression and have it parsed into a custom field.

But now, how do you concatenate the current title with that field?
So not just a replace.

 

thanks

Mike Harrison _The Plugin People_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2019

If you are using JEMH 2.5.1 or newer, you have access to the Script Field Processor. This allows more freedom in getting JEMH to do exactly what you want.

The following script extracts a value from the email body using a regular expression, and puts the value on the end of the summary. All of this only happens if the email relates to an existing issue:

if (relatedIssue) {
var regex = /value:\s?([^\n]+)/;
var found = body.match(regex);
var value = "";

if (found.length > 1) {
value = found[1];
}

if (value.length > 0) {
resultMap.put("summary", relatedIssue.getSummary() + value);
}
}
Like Serge_tkint likes this
Serge_tkint February 27, 2019

That's a nice one.
Will try it tomorrow. 

thanks

Suggest an answer

Log in or Sign up to answer