Facing issue in getdirectgroupmemberuserspaging()

Hi 

 

I am working on version 17.3.

My scenario is that based on logged in user's group, users are populated in a user picker field from desired two relevant groups. Rather than making a super group which has these two desired groups a member and passing this group in a!pickerFieldUsers() groupFilter; I am making use of a!pickerFieldCustom() where as suggestFunction; I am passing these two groups.

 

The code snippet for same is:

=load(
  local!assignedTo,
  local!userLabels:{getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP1_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP1_GROUP,0,-1)},
  local!users:a!forEach(
    items:local!userLabels,
    expression:user(fv!item,"firstName")&" "&user(fv!item,"lastName")
  ),
  local!userIdentifiers:{getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP1_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP1_GROUP,0,-1)},
  
  a!pickerFieldCustom(
    label: "User Selected",
    instructions: "Value saved: " & local!assignedTo,
    suggestFunction: rule!ucArrayPickerFilter(
      filter:_ , 
      labels: local!users,
      identifiers:local!userIdentifiers
    ),
    selectedLabels: a!forEach(
      items: local!assignedTo,
      expression: index(local!users, wherecontains(fv!item, local!userIdentifiers))
    ),
    value: local!assignedTo,
    saveInto: local!assignedTo
  )
  
)

The code for the supporting rule in the above code i.e. rule!ucArrayPickerFilter() is:

 

=with(
  local!matches: where(
    a!forEach(
      items: ri!labels, 
      expression: search( ri!filter, fv!item)
    )
  ),
  a!dataSubset(
    data: index( ri!labels, local!matches), 
    identifiers: index( ri!identifiers, local!matches)
  )
)

where filter of type Text

          labels of type User array

          identifiers of type User array

 

The above code works fine i.e. i get all the users from both the desired groups as a suggestion to user to select from.

However, if I try to populated values for suggestFunction based on condition, then I get only one user from both the desired groups as a suggestion to user to select from.

=load(
  local!assignedTo,
  local!userLabels:if(rule!getGroupIdOfManager()=229,
                    {getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP1_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP1_GROUP,0,-1)},
                    {getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP2_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP2_GROUP,0,-1)}
  ),
  local!users:a!forEach(
    items:local!userLabels,
    expression:user(fv!item,"firstName")&" "&user(fv!item,"lastName")
  ),
  local!userIdentifiers:if(rule!PH_getGroupIdOfManager()=229,
                          {getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP1_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP1_GROUP,0,-1)},
                          {getdirectgroupmemberuserspaging(cons!TASK_BASIC_USER_GROUP2_GROUP,0,-1),getdirectgroupmemberuserspaging(cons!TASK_MANAGER_GROUP2_GROUP,0,-1)}
  ),
  
  a!pickerFieldCustom(
    label: "User Selected",
    instructions: "Value saved: " & local!assignedTo,
    suggestFunction: rule!ucArrayPickerFilter(
      filter:_ , 
      labels: local!users,
      identifiers:local!userIdentifiers
    ),
    selectedLabels: a!forEach(
      items: local!assignedTo,
      expression: index(local!users, wherecontains(fv!item, local!userIdentifiers))
    ),
    value: local!assignedTo,
    saveInto: local!assignedTo
  )

)

Can any one help me out with this.

 

Thanks in advance!! 

 

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data