Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Storing catch email address information in issues

Velocity reference

 

Description

Description

Link

Code Block
$catchEmailAddress

https://jemhcloud.thepluginpeople.com/app/static/javadoc/com/thepluginpeople/jemhod/api/IEmailAndPersonal.html

Contains the email address $catchEmailAddress.getEmailAddress() and (optionally) the personal $catchEmailAddress.getPersonal() of the catch email address found in the processed email

Code Block$matchingRecipient

https://

docs

jemhcloud.

oracle

thepluginpeople.com/app/

en

static/

java

javadoc/

javase

com/

11

thepluginpeople/

docs

jemhod/api/

java.base/java/lang/String

IEmailAndPersonal.html

Code Block
$matchingRecipient

Shorthand for $catchEmailAddress.getEmailAddress() (see above).

Code Block$matchingCatchEmailAddress

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

Code Block
$matchingCatchEmailAddress

A string representing the configuration responsible for finding the catch email address. Depending on what was configured in the profile, this could be a static address or a regular expression.

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

When using this custom field value later (e.g. in templates):

Code Block
#if ( $!context.issue.fields.customfield_13900.value.asText() && $context.issue.fields.customfield_13900.value.asText().equalsIgnoreCase("inboundmailboxaddress@domain.com") )
matched
#else
didnt match
#end

Setting a Date field 1 day in the future

...

  1. Go to Profile > Project Mapping > Issue > Edit

  2. Under CUSTOM FIELDS DEFAULTS you will see the available custom fields for the project mapping's project.

  3. Find your custom date field, select Velocity and when you want the field to be updated.

  4. Enter the following script: 

     

    Code Block
    #set($longVal = $currentMillis.longValue() + 86400000 )  
    $dateFormatter.formatDate($jemhDateUtils.createDate($longVal))
    

    $longVal is defined as a variable, (with the value of the current time in milliseconds, plus 24(hourshrs)*60(minutesmins)*60(secondssecs)*1000(millisms) = 8640000), then the $dateFormatter is in charge of rendering the date generated from $jemhDateUtils.createDate.

     

Screen will look like:

...

After submitting:

...

Now, issues created or updated, will have the Custom Field Custom Date Picker set with a dynamically generated value of 28/Jan/16, which is parsed and set in the issue.

...

Email address headers like To:, Cc:, Bcc:, From: should be retrieved using $message.getTo(), $message $message.getCc(), $message $message.getBcc(), $message.getRecipients(), $message.getFrom() methods from the IMessage object. These methods know how to handle email and personal addresses returning a list of IEmailAndPersonal objects. These objects have aValue. getEmailAddress() and aValue.getPersonal() methods so you can print the proper information (just just email address or just personal). Alternately to render more details. Alternately the full email address can be printed with aValue.toString() fully. E.g.: John Doe <john.doe@company.com>Custom header Specific headers can be extracted through $message.getHeader("HEADERNAME").  

Entering the following script in the Custom Fields Defaults section under Profile > Project Mapping > Issue will extract the information from the given email headers:

Code Block
#set ( $mimeVersion = "" )
#foreach ($aValue in $message.getHeader("MIME-Version"))
  #set ( $mimeVersion = "$mimeVersion#if(!$foreach.first), #end$aValue")
#end

#set ( $toAddress = "" )
#foreach ($aValue in $message.getTo())
  #set ( $toAddress = "$toAddress#if(!$foreach.first), #end$aValue.getEmailAddress()")
#end

#set ( $customHeader = "" )
#foreach ($aValue in $message.getHeader("Some-Make-Believe-Header"))
  #set ( $customHeader = "$customHeader#if(!$foreach.first), #end$aValue")
#end

Mime Version = $mimeVersion
Sent To = $toAddress
Some-Make-Believe-Header = $customHeader


This scripts comma separates multiples values when rendering the field value. You can revisit $message methods in it javadocits Javadoc page.

...

Running the test case will result in the information from our desired headers being stored in the custom field Original Message Details.

...

It is also possible to extract the The name of the project mapping that was used to create the issue by using $projectMapping $projectMapping.name.

Filter by label
showLabelsfalse
max5
sortmodified
showSpacefalse
reversetrue
cqllabel in ( "custom-field-default" , "scripting" , "issue" ) and space = "JEMHC" and type = "page"