Tag Archives: ldap

Population of Connections Database Field DisplayName if this entry does not exist in LDAP

Today I noticed in a customer installation that nowhere in the LDAP a usable displayname (aka “Martti Garden”) was available.  My collegue Barbara Koch helped me out solving this:  The attributes surname (sn) as well as givenname (givenname) were available to I had to compute the display name.

 

So I edited the profiles_functions.js and added the following function:

 

// Function to compute the displayname from given name and surname

func_compute_dn(fieldname)

// Get the content of the “sn” field as a string

{
var surname = work.getString(“sn”);

// Get the content of the “givenname” field as a string

var vorname = work.getString(“givenname”);

// If both entries are not empty

if (vorname != null && nachname != null) {

// return first name and last name separated by a space

return vorname + ” ” + nachname;

// otherwise

}

else {

// return the content of the “cn” field as a string, if it is empty it will return NULL

return work.getAttribute(“cn”);

}
}

 

Now I had to edit the map_dbrepos_from_source.properties and mapped the function to the diplayname field:

displayname={func_compute_dn}


Now I ran the populate_from_dn_file script and had the Displayname showed correctly in IBM Connections.