index output in rule expression

Team,

I have a below output from my expression and when i am using dot notation as local!data.totalCount i can filter output , however i am not able to do the same for local!data.name

how to do it ? tried indexing also but data coming null


[startIndex=1, batchSize=-1, sort=, totalCount=1, data=[givenname:abc,sn:def,mail:abc2@cde.com,samaccountname:abc]

i want to index , name , sname and mail for my grid

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Can you post the full expression? If you're trying to run this in a!forEach(), there should be an easier way that doesn't require a loop (and then you can directly reference the fields you want); however, I'd need to see the full expression to provide a better suggestion.

  • For some reason your dataset is an array of type datasubset - you can see this because it is tagged: List of DataSubset: 1 item. This isn't usually how datasubsets are generated or passed about in an application, so you may want to find out why this is being generated as an array. 

  • PFB code:

    with(
    local!id:ri!user,
    local!ldap:a!forEach(
    items: local!id,
    expression: ldapsearch(
    config:{
    scsExternalSystemKey: cons!CREDENTIALS,
    usePerUserCredentials: false(),
    url: cons!URL,
    timeout: 10000,
    VLVControlSupported: false()
    },
    searchFilter:"(&(objectCategory=User)(samaccountname=" &fv!item& "*)(!(userAccountControl:1)))",
    attributes: {
    /*"cn",*/
    "sn",
    "mail",
    "samaccountname",
    "givenname"
    },
    pagingInfo: a!pagingInfo(1,-1)
    )
    ).result,
    local!ldap
    )

  • Are you expecting ri!user to contain a list of users, or would it only be a single user? If it's only a single user, then I'd recommend removing the a!forEach() and directly querying the data - then you should be able to index the data correctly.

    If you are expecting an array of users, is it possible to reconstruct your search filter to search for multiple users at once? I must confess, I am not an expert at LDAP queries, so I'm not sure if this is possible. However, I'd recommend thinking of ways to return this data in a single query. If you use a!forEach() with ldapsearch() it will perform the search invidually for each item in the list which may lead to poor performance.