I am trying to find a way to do a conditional mapping of my LDAP customer data so I can do more informal salutations (so Bob instead of Robert). Our LDAP has fields for givenName (ie. Robert) and displayName (ie. Bob). The users can set their displayName themselves and some do, but sometimes the field is blank. I want the displayName to be used for salutations if it exists, but use the givenName if it doesn't.
I have added a custom tag called UserPrefName that is assigned by displayName in the LDAP mapping in Config.pm:
Code: Select all
[ 'UserPrefName', 'Preferred Name', 'displayName', 1, 0, 'var', '', 0 ].
This works great if something is in displayName. However I have a problem when there is nothing in the displayName field - it is left blank in my salutations.
I found a reference to a conditional mapping on an OTRS forum thread (
http://forums.otrs.org/viewtopic.php?f= ... nal#p22701) but it is in German. But after using google translate, it appears this is a way to assign a Mr or Mrs based on a value in an LDAP field. The solution given is:
Code: Select all
[ 'UserSalutation', 'Salutation', 'IF(geslacht = 1, "heer", "mevrouw") AS aanhef', 1, 0, 'var', '', 0 ],
Does the syntax of "IF(geslacht = 1, "heer", "mevrouw") AS aanhef'" look like something that LDAP would understand? I want to assign UserPrefName to displayName if it exists, but to use givenName if it doesn't.