/
Perform searches with LDAP

Perform searches with LDAP

The following solution was kindly provided by Stefano Gevinti.

Problem

When creating an issue, you want to initially assign it to the current user's manager for review. However, Jira lacks a predefined manager role (for example, as a project admin). To address this, you need to access the Lightweight Directory Access Protocol (LDAP).

Solution

 

  1. Enter the script provided below:

create_postfunction.sil
string mgr = ldapUserAttr("manager", "(sAMAccountName=" + currentUser() + ")"); //get the current user's manager DN string cnUser = substring(mgr, 0, indexOf(mgr,",")); //establish the cn, this is the manager user (that may depend on your setup) string mgrUserName = ldapUserAttr("sAMAccountName", cnUser); //again, a lookup in the Active Directory to get the manager //Note: these LDAP calls are automatically cached, so performance gets better if it is found in cache if(userExists(mgrUserName)) { //make sure this is defined in JIRA assignee = mgrUserName; } else { //fallback to project admin assignee = projectPM(project); }

In this script, we used the preferred ldapUserAttr function but you can also use the deprecated ldapUserRecord function.

When creating an issue, make sure that this post function is the final step in the call chain.

  1. Next, configure the LDAP.

 

Related content

ldapUserAttr
Read with this
Perform searches with LDAP
Perform searches with LDAP
More like this
Function Index
Read with this
LDAP searches
LDAP searches
More like this
Getting Started with Power Scripts for Jira Cloud
Getting Started with Power Scripts for Jira Cloud
Read with this
Create a Jira Issue from Salesforce
Create a Jira Issue from Salesforce
More like this