Process variables generated by Appian - type mismatch

I had a case with my process in which process variables generated by Appian gave me warning about type mismatch.

These are my process variables for the employee update process at the moment:

For some reason variable employee wasn't mapped to value employee at first (while address which is also CDT was mapped without problems).

I got the message "The following rule inputs have been mapped to a process variable of a different type:..." It mentioned something with list (now I can't reproduce the situation as if I try to clear my interface from the process start form and add it again and let process variables be created by Appian - it creates successfully, without this warning).

On the other hand, for similar interface for the process of creating new employee everything was generated fine from the beginning.

The only thing that looks like it could be the reason is the fact that on creation process employee is CDT rule input initially populated by the end user and on update process it is populated by expression rule (query for fetching selected employee based on end user's dropdown choice).

This is the first place where process variable employee is populated in the process (and handling for more or less than 1 result row is implemented):

 a!buttonWidget(
            label: "Next",
            value: local!activeStep + 1,
            saveInto: {
              local!activeStep,
              if(
                local!activeStep = 2,
                a!save(
                  ri!employee,
                  rule!EEDM_GetEmployeeById(
                    ri!selectedEmployee
                  )
                ),
                null
              ),

This is my expression rule for fetching employee details:

a!queryEntity(
  entity: cons!EEDM_EMPLOYEE_DATA_STORE_ENTITY,
  query: a!query(
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "id",
          operator: "=",
          value: ri!id
        )
      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 50
    )
  ),
  fetchTotalCount: false
).data

My question is:

Is it some feature of Appian to assume that my rule input is list if it is populated by query? Does Appian recognize it when it first encounters my rule input employee during parsing my interface code? 

Is there a way to prevent that (by modifying expression rule to return exactly one row or something like that) or I should let Appian generate process variable as it does and then delete it manually and create my own which is of correct type?

  Discussion posts and replies are publicly visible