Expression Evaluation in rule - A User and group Picker component [label ='']has an invalid value for value. All users and groups must be valid and visible to the viewer

Hi,

I am getting above error while selecting user for task assignment on the interface.

a!pickerFieldUsersAndGroups(
value: rule!<rulename>(
fv!item.Assignee
),

Rule code

if(
rule!APN_isBlank(
ri!userOrGroup
),
null,
if(
charat(
tostring(
ri!userOrGroup
),
1
) = "[",
togroup(
ri!userOrGroup
),
touser(
ri!userOrGroup
)
)
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Looks like some values in fv!item.Assignee is not having a valid username/ group name.

    I was able to reproduce the error you are getting when I pass a value which is not an Appian username in the environment. Code wise everything looks good and its working for me. So check the data in this Assignee field for any extra characters or invalid data in it which is not a valid username/group name. 

    To debug/validate data or find the wrong usernames you can use the function isusernametaken(fv!item.Assignee) to see for which data set it returns false. 

    To validate group names you can use a!doesGroupExist(ri!userOrGroup) function

  • Hi  Thanks for your response.

    I tried, but somehow unable to debug. Sorry I am new to Appian

  • 0
    Certified Lead Developer
    in reply to nirupamaanuragt

    No need to be sorry, we are here to help!

    Firstly you can check the values in the Assignee column of your list. 
    In the pickerFieldUsersAndGroups() code that you have on your interface, can you try the below code and check the results. 

     a!pickerFieldUsersAndGroups(
        instructions: a!foreach(
          local!list, /*Replace with the list you have in your foreach()*/
          if(
            rule!APN_isBlank(fv!item.Assignee),
            null,
            if(
              charat(tostring(fv!item.Assignee), 1) = "[",
              a!doesGroupExist(tointeger(fv!item.Assignee)),
             
              isusernametaken(fv!item.Assignee)
            )
          )
        ),

    In my case as you can see here I have the output like this 

    In the instructions I have false at index 3 which means 3rd item in the list is invalid. Similarly check for your list which all values in the Assignee field is invalid. 

    P.S. as the list will have group id and not the name, I have updated previous answer to check valid groups using a!doesGroupExist() instead of a!groupsByName(). 

Reply
  • 0
    Certified Lead Developer
    in reply to nirupamaanuragt

    No need to be sorry, we are here to help!

    Firstly you can check the values in the Assignee column of your list. 
    In the pickerFieldUsersAndGroups() code that you have on your interface, can you try the below code and check the results. 

     a!pickerFieldUsersAndGroups(
        instructions: a!foreach(
          local!list, /*Replace with the list you have in your foreach()*/
          if(
            rule!APN_isBlank(fv!item.Assignee),
            null,
            if(
              charat(tostring(fv!item.Assignee), 1) = "[",
              a!doesGroupExist(tointeger(fv!item.Assignee)),
             
              isusernametaken(fv!item.Assignee)
            )
          )
        ),

    In my case as you can see here I have the output like this 

    In the instructions I have false at index 3 which means 3rd item in the list is invalid. Similarly check for your list which all values in the Assignee field is invalid. 

    P.S. as the list will have group id and not the name, I have updated previous answer to check valid groups using a!doesGroupExist() instead of a!groupsByName(). 

Children
No Data