Issue with a!pickerFieldUsersAndGroups field use in editable grid a!gridRowLayout()

Certified Associate Developer

We have Appian 17.3 and 21.1 environments - I am using a!pickerFieldUsersAndGroups() field inside editable grid to allow users to pick either a user or a group. No issue when picking a user, but when I pick any group then I got the following error "Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!pickerFieldUsersAndGroups [line 100]: A user and group picker component [label=“Primary Assignee”] has an invalid value for “value”. All users and groups must be valid and visible to the viewer."  

When I use a!pickerFieldUsersAndGroups() outside of the editable grid, picking a user or a group works with no issue.

Also, when using a!pickerFieldGroups() or a!pickerFieldUsers() inside editable grid works just fine.

Appreciate any help on this issue.

  Discussion posts and replies are publicly visible

  • Are you able to share the SAIL for your interface/grid setup?  That would assist with debugging here.  I haven't run into this issue previously (aside from group permission configuration issues), but I may not have any user and group pickers in my grids..

  • 0
    Certified Associate Developer
    in reply to Chris

    Here is the editable grid with single field, populated by single text field CDT:

        a!gridLayout(
           label: "List of Assignees",
           emptyGridMessage: "",
           totalCount: count(ri!activeAssigneeList),
           instructions: "", 
           headerCells: {
             a!gridLayoutHeaderCell(label: "* Primary Assignee"),
           },
           columnConfigs: {
             a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1.5)
           },
           rows: a!forEach(
             items: ri!activeAssigneeList,
             expression: a!gridRowLayout(
               contents: {
                 a!pickerFieldUsersAndGroups(
                   label: "Primary Assignee",                     
                   maxSelections: 1,   
                   required: true,
                   groupFilter: cons!ALL_GRPS,
                   value: fv!item.priAssignee,
                   saveInto: {fv!item.priAssignee},
                   validations: {}
                 )
         },
               id: fv!index
       )
      )
     )

  • One thing I notice initially is that while you can use fv!item for the value of the picker, you cannot saveInto the fv!item instance of the a!forEach().  Instead you will want to save directly to the CDT.  Try this below with an updated saveInto:

        a!gridLayout(
          label: "List of Assignees",
          emptyGridMessage: "",
          totalCount: count(ri!activeAssigneeList),
          instructions: "", 
          headerCells: {
            a!gridLayoutHeaderCell(label: "* Primary Assignee"),
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1.5)
          },
          rows: a!forEach(
            items: ri!activeAssigneeList,
            expression: a!gridRowLayout(
              contents: {
                a!pickerFieldUsersAndGroups(
                  label: "Primary Assignee",                     
                  maxSelections: 1,   
                  required: true,
                  groupFilter: cons!ALL_GRPS,
                  value: fv!item.priAssignee,
                  /*saveInto: {fv!item.priAssignee},*/
                  saveInto: ri!activeAssigneeList[fv!index].priAssignee,
                  validations: {}
                )
              },
              id: fv!index
            )
          )
        )

  • 0
    Certified Associate Developer
    in reply to Chris

    Both methods worked...new value saved into the CDT just fine.

  • 0
    Certified Associate Developer
    in reply to Todd Tran

    For both saveInto methods, only selected user saved, selected group still same error.

  • The problem is likely due to the data type of the field that you're saving into. Appian does a pretty good job of casting back and forth between the Text and User types, but the group is usually stored as an integer. So suppose you save a group with ID 10 into your variable. Now the variable stores the result as "10". However, if there's text, Appian assumes the result is a user, and it doesn't find any user name called "10".

    I think you'll need to temporarily store the results into a local variable (since that can accept any type). Then, on saving the results, cast everything in the list to text and save to your CDT. This also means you'll need to cast back whenever you query this information from the database to ensure the results are returned as users and groups instead of text.