- Working with synchronized data
- Presenting synchronized data
- Hiding attributes based on group memberships
- Using synchronized data in workflow
- Using synchronized data in JQL
- Using synchronized data in notification
Using synchronized data in notification
This page provides information on using data, synchronized by Active Directory Attributes Sync app, in email templates.
To use user’s attributes from Active Directory in email templates, use in the velocity template the following code:
$!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject($customfieldKey).get("valueMap").get($connectionId).get("userAttr").get($userAttributeKey)
Variables needed for the phrase are listed below:
- $customfieldKey - key of the custom field of the type [Deviniti] User’s attributes from Active Directory (AD).
- $connectionId - id of Active Directory or LDAP server connection (to check it, go to the Add-on > Active Directory Attributes Sync > Connections - section Details).
- $userAttributeKey - key of the user attribute in Jira, for example: ‘Telephone Number’, ‘Department’, ‘Title’, etc.
Examples
To get the attribute Telephone Number value from customfield [Deviniti] User’s attributes from Active Directory (AD) which value is customfield_10101, and for connection which id is equals 2, use the following expression:
$!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10101')).get("valueMap").get("2").get("userAttr").get("Telephone Number")
To get the attribute Department value from customfield [Deviniti] User’s attributes from Active Directory (AD) which value is customfield_10203, and for connection which id is equals 4, use the following expression:
$!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10203')).get("valueMap").get("4").get("userAttr").get("Department")
To extract and present user’s attribute in the velocity email template (HTML), use the following expression:
issueresolved.vm
Hi,</br>
Your issue $!issue.key has been resolved</br>
</br>
Best regards</br>
$!issue.assignee.displayName</br>
$!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10101')).get("valueMap").get("2").get("userAttr").get("Title")</br>
$!issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10101')).get("valueMap").get("2").get("userAttr").get("Telephone Number")
If you can’t find the answer you need in our documentation, raise a support request.