Customizing Display Name IBM Connections 4.x

One of the most important part of the IBM Connections is the person profile.  

The full name of the person, in general, is stored on a corporate LDAP.   Last week i am in charge to populate the profiles database with photos, and a lot of data from LDAP.

The person attributes on the ldap , like SN, CN, Display name was in capital letters like FIRST NAME LAST NAME.  We don´t want this kind of display names,

The solution: Custon function before importing the users.

Copy this function to the file profiles_functions.js

function func_name (fieldname){
  //get attributes
  var nome      work.getAttribute("givenName");
  var sobrenome = work.getAttribute("sn");
  var fullname  = nome + " " + sobrenome;

  return properCase(fullname);


  function properCase(text) {
    var articles = [ 'e','o', 'a', 'de', 'da', 'dos', 'das']

    return map(text.split(/s+/), function(word) {
                                    return isArticle(word)?  word.toLowerCase()
                                    :      /* otherwise */   capitalise(word) })
           .join(' ')

    function map(xs, f) {
      var l = xs.length, r = new Array(xs.length)
      for (var i = 0; i < l; ++i) r[i] = f(xs[i])
      return r }

    function has(xs, x) {
      for (var i = 0; i < xs.length; ++i)
        if (xs[i] === x)  return true
      return false }

    function capitalise(word) {
      return word.slice(0, 1).toUpperCase() + word.slice(1).toLowerCase() }

    function isArticle(word) {
      return has(articles, word.toLowerCase()) }}
}

Change the attribute displayname on the file map_dbrepos_from_source.properties

displayName={func_name}

Run the ./sync_all_dns.sh