Hello CommunityI have created an LDAP Scripted field "Abteilung", which shows the departments of all employees. The problem is that I can't remove the duplicate departments from this new field. Any ideas?Thank you
Ozan
You could potentially write a Behavior that takes all of the field options and adds them to an array, then update that array to only include the unique options and then set that as the list of options in the field.
package Testimport com.onresolve.scriptrunner.ldap.LdapUtilimport org.springframework.ldap.core.AttributesMapperimport javax.naming.directory.SearchControls
// Keine Führungspersonendef filter="(&(ou=IA*)(!(directReports=*)))"
def cnOU = LdapUtil.withTemplate('LDAP-User') { template ->template.search("", filter, SearchControls.SUBTREE_SCOPE, { attributes ->attributes.get('ou').get()} as AttributesMapper<String>)}
def cnOUUniqueValues = []def cnOUSeen = []
cnOU.each { item -> def value = item.split(", ")[0]
if (! cnOUSeen.contains(value)) { cnOUUniqueValues << item }
cnOUSeen << value }
log.warn('OU-Liste:')log.warn(cnOU)log.warn('OU-Liste Unique:')log.warn(cnOUUniqueValues)
Thanks for your advice Matt.
I am not a developer and I was able to build such a script with the help of google. I can list them in the console but I don't know how to do it in an LDAP field.
I have already tried the script for my LDAP field (through Behaviors) but no success.
I also tried the script for single select field, but I could not display any options at all
It looks like you're new here. Sign in or register to get started.