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
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
The error occurs because some values in fv!item.Assignee are not valid Appian usernames or group names. Your code is correct, But invalid or extra characters in the data cause this issue.Validate username and Group before passing it to pickerField.
This makes your code much more readable.
You will have to add code that checks whether the result is a valid user.
Hi Harsha Sharma Thanks for your response.
I tried, but somehow unable to debug. Sorry I am new to Appian
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().