Hello Community
I 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 Test
import com.onresolve.scriptrunner.ldap.LdapUtil
import org.springframework.ldap.core.AttributesMapper
import javax.naming.directory.SearchControls
// Keine Führungspersonen
def 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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.