Expand a distribution group email address

since 3.3.62

Intro

Distribution Group addresses are a special kind of group, with an email address, they may be comprised of a direct set of recipients, as well as additional groups (and users and sub groups within etc). JEMH provides the ability to dynamically expand these group addresses to discover recipients.

Performance

Distribution group queries go through a cache, which retains dist-list members for 1hour. At most 1000 group addresses will be stored.

Logs

Lower level debug about what exactly JEMH is doing with the LDAP query can be found in the jemh.log:

Context

When scripts run in the context of a Profile, (Pre-Processing Task, Script Field Processor, Script Rule) the jemhUtils helper class can be used to to query LDAP for distribution group expansion:

Here, jemhUtils.getLdap() will get an LDAP specific helper class http://ppl-docs.s3-website-us-east-1.amazonaws.com/JEMH/3.3.115/com/javahollic/jira/emh/api/IJEMHLdapVelocityContextUtil.html that supports a new operation expandDistributionGroupAddress(“x@y.com”). The result is a list of simple text email addresses.

Example Script

var ldap = jemhUtils.getLdap(); print('ldap: '+ldap.class); var results = ldap.expandDistributionGroupAddress("dist-group@dev.ppl.com"); //dist-group@dev.ppl.com if (results === null || results.size()===0) { print('no results.. Check Profile actually has LDAP configs selected, or use jemhUtils.getLpda(int) to pick a config'); } else { var resultCnt = results.size() print('Found '+resultCnt+' results: '+results.class); //for (let i = 0 ; i < resultCnt; i++) var i=0; for (; i<resultCnt; i++) { print('['+i+'] = '+results.get(i)); } }

Example Script output

ldap: class com.javahollic.jira.emh.service.DefaultJEMHLdapVelocityContextUtil Found 4 results: class java.util.ArrayList [0] = andy@dev.ppl.com [1] = test1@dev.ppl.com [2] = mharrison@dev.ppl.com [3] = primary@localhost