Using LDAP in Notification templates
Since 3.3.13
Summary
This article shows how JEMH Notification Templates can embed or customise notification content based on data from LDAP queries, based on configurations created in the JEMH > LDAP section. This will work with:
Script Field Processor - see Using LDAP in Script Field Processor
Adhoc notifications
Postfunction notifications
Issue Event Notifications
Prerequisites
JEMH Version 3. 3.13 (Jira 8+)
You should already have a functioning LDAP configuration in JEMH.
Example to get nominated set of attributes
since 3.3.46
<h3>Get Named Atts Only</h3>
#set($requiredAttributes = ["sAMAccountName","distinguishedName","mail", "memberOf"])
#set($namedAttResults = $jemhUtils.getLdap(1).getUserAttributes("(sAMAccountName=andy)", $requiredAttributes))
<p>Got $namedAttResults.size() attributes:</p>
<p>
<UL>
<LI>mail = $namedAttResults.get("sAMAccountName").get(0)</LI>
<LI>distinguishedName = $namedAttResults.get("distinguishedName").get(0)</LI>
<LI>mail = $namedAttResults.get("mail").get(0)</LI>
<LI>memberOf = $namedAttResults.get("memberOf").get(0)</LI>
</UL>
</p>
Example output
Performance
Currently, retrieved data is not cached, every invocation triggers a call to the remote server. If your notifications are in response to interactive user actions, their user interfaces experience could be degraded as the user ‘submit’ doesn’t complete until the notifications have been rendered and queued for delivery.
A future feature has been logged to add cache support :