Unable to save selected value as list item

Dear Community,

I have created a simple interface (csr_ui_requesttask_userfiltersui in this example) that has a list of Map as rule input (inputRecordSets in this example). The structure of the Map (list items) is as follows (attributes)


a!map(
  labels: { "Option A", "Option B", "Option C" },
  choiceValues: { "Value A", "Value B", "Value C" },
  selectedValues: { "Value B", "Value C" }
)

The idea is to have a reusable interface that will display a multi-select drowdown box for each list item.

Dropdown item choice labels, choice values and initially selected options (values) will be provided by the labels, choiceValues and selectedValues attributes.

For example, when I call the expression rule from another interface and pass a list consisting of two items (two maps), two dropdown boxes should be displayed.

This is the code of the interface:

{
  a!columnsLayout(
    columns: {
      a!columnLayout(
        contents: {
          a!forEach(
            items: ri!inputRecordSets,
            expression: a!localVariables(
              local!listItem: fv!item,
              a!multipleDropdownField(
                choiceLabels: local!listItem.labels,
                choiceValues: local!listItem.choiceValues,
                label: "Dummy",
                value: fv!item.selectedValues,
                saveInto: { fv!item.selectedValues }
              )
            )
          )
        }
      )
    }
  )
}

I use following expression to populate the rule input for testing purposes:

{
  a!map(
    labels: { "Option A", "Option B", "Option C" },
    choiceValues: { "Value A", "Value B", "Value C" },
    selectedValues: {}
  ),
  a!map(
    labels: { "Option A", "Option B", "Option C" },
    choiceValues: { "Value A", "Value B", "Value C" },
    selectedValues: { "Value A", "Value B", "Value C" }
  )
}

So far - so good. When I test the interface, every is functioning as expected.

I'm able to select / unselect options from the two dropdown boxes displayed without any issues. I see (by monitoring the rule input) that any change is reflected on the rule input.

The issue arises when I try to call this interface (as expression rule) from another interface.

I have created a second interface where I call the previous one. Please find the code below:

a!localVariables(
  
  local!d1: a!map(
    labels: { "Option A", "Option B", "Option C" },
    choiceValues: { "Value A", "Value B", "Value C" },
    selectedValues: { "Value A" , "Value C"}
  ),
  local!d2: a!map(
    labels: { "Option A", "Option B", "Option C" },
    choiceValues: { "Value A", "Value B", "Value C" },
    selectedValues: { "Value A" , "Value B"}
  ),
  
  rule!CSR_UI_RequestTask_UserFiltersUI(
    inputRecordSets: {local!d1, local!d2}
  )
)

I see those two dropdown boxes with options selected as expected, but as soon as I try to select another option (or deselect) I got an error stating:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = a98d2:43dbb] in rule 'csr_ui_requesttask_userfiltersui' : An error occurred while executing a save: Expression evaluation error: The save target must be a local variable that does not refresh on every evaluation or on an interval, a process variable, or a node input (or a rule input passed one of those three), but instead was: [labels:Option A; Option B; Option C,choiceValues:Value A; Value B; Value C,selectedValues:Value A; Value B]; [labels:Option A; Option B; Option C,choiceValues:Value A; Value B; Value C,selectedValues:Value A; Value B]

I'm aware that there are some restrictions on using rule inputs as saveInto targets, but I must admit I don't understand them properly.

I have already checked

https://docs.appian.com/suite/help/24.2/enabling_user_interaction.html#rule-inputs

but I don't see the relation between my use case and the restrictions described.

It seems related to the fact that I'm trying to pass a list or use list items as save targets because it works if I declare the rule input as a single Map item (not a list!) and pass a single Map as value.

Unfortunately, this approach is not feasible as it would require a large number of placeholder rule inputs. I would have to check for null on each particular rule input and create a generate a drowdown box if value is provided. Not impossible but I hope that there as a cleaner way to solve this.

If somebody has already encountered the error above or has an idea how to solve it (or maybe has a idea about another aproach), kindly asking for help.

Regards,

  Discussion posts and replies are publicly visible