userSearch Function and LDAP

#LDAP #userSearchI'm importing the manager field from LDAP into a customField1. The value that comes from Active Directory is "CN=Jetson\\, George,OU=Users,OU=Metropolis,DC=SpacelySprockets,DC=local "i can isolate the first name and last name by usign the extract(), substitute() and split() functions. split( substitute( extract(user(ri!user,"customField1"),"CN=",",OU="),"\\",""),",") which results in a list of text string "Jetson; George"Since the value property of userSearch() takes a "list of Text String" I should be able to pass the output of the split function to the userSearch function and get gjetson, the user expected. I can confirm the user exists by trying this piece of code... usersearch({"lastName","firstName"},{1,1}, {"Jetson","George"}) and confirm the user gjetson is returned.however, when I try using the output of split as the value property, it always returns a null. I've tried multiple permutations. loa...

OriginalPostID-248022

  Discussion posts and replies are publicly visible

Parents
  • If the above is correct, then you may slightly change the way(refer the code below) you split provided if it's a standard pattern across all the values:

    load(
    local!name: split(
    substitute(
    extract(
    "CN=Jetson\\, George,OU=Users,OU=Metropolis,DC=SpacelySprockets,DC=local ",
    "CN=",
    ",OU="
    ),
    "\\",
    ""
    ),
    ", "
              /*Use the comma with space as a separator(rather than comma) in the split(), as there is a space after the comma, that is prior to firstName*/
    ),
    usersearch(
    {
    "lastName",
    "firstName"
    },
    {
    1,
    1
    },
    local!name
    )
    )
Reply
  • If the above is correct, then you may slightly change the way(refer the code below) you split provided if it's a standard pattern across all the values:

    load(
    local!name: split(
    substitute(
    extract(
    "CN=Jetson\\, George,OU=Users,OU=Metropolis,DC=SpacelySprockets,DC=local ",
    "CN=",
    ",OU="
    ),
    "\\",
    ""
    ),
    ", "
              /*Use the comma with space as a separator(rather than comma) in the split(), as there is a space after the comma, that is prior to firstName*/
    ),
    usersearch(
    {
    "lastName",
    "firstName"
    },
    {
    1,
    1
    },
    local!name
    )
    )
Children
No Data