How to get username on the basis of customField1?

Certified Associate Developer

Hello All,

I have requirement to fetch user name on the basis of customField1. How can I achieve this? Thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    Below is the code I used to create such a rule.

    This rule uses one input "customField1" (Text) and a constant containing a group with all users. You can use this rule to pass in the customField1 value you are searching for to return an array of users.

    with(
    local!userDictionary: a!forEach(
    items: getdistinctusers(
    cons!AllUsers
    ),
    expression: {
    user: fv!item,
    customField1: user(
    fv!item,
    "customField1"
    )
    }
    ),
    index(
    local!userDictionary,
    "user",
    wherecontains(
    ri!customField1,
    touniformstring(
    local!userDictionary.customField1
    )
    ),
    null
    )
    )

    I hope this is useful.
    Brad
Reply
  • Hi,

    Below is the code I used to create such a rule.

    This rule uses one input "customField1" (Text) and a constant containing a group with all users. You can use this rule to pass in the customField1 value you are searching for to return an array of users.

    with(
    local!userDictionary: a!forEach(
    items: getdistinctusers(
    cons!AllUsers
    ),
    expression: {
    user: fv!item,
    customField1: user(
    fv!item,
    "customField1"
    )
    }
    ),
    index(
    local!userDictionary,
    "user",
    wherecontains(
    ri!customField1,
    touniformstring(
    local!userDictionary.customField1
    )
    ),
    null
    )
    )

    I hope this is useful.
    Brad
Children