QueryRecord

Certified Senior Developer

Hi All I am trying to design a generic rule which will take recordtype. filter fields and filter values and filter operators and final filed as inputs and it should give result of that final field after ruining the query Record and applying the aggregation.
It is working if the filter are single or multiple and all filter operators are "=","<>","<",">" but not when filters are multiple and operators are mix of in ,= or not in,= .
here is the code i have used.
 

a!localVariables(
  local!filterFields: { recordFields },
  local!filterValues: { a!update(a!map(), "1", { 21, 27 }), true() },
  local!filterOperators: { "in", "=" },
  index(
    a!queryRecordType(
      recordType: recordName,
      fields: finalOutputField,
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: a!forEach(
          items: { local!filterFields },
          expression: a!queryFilter(
            field: fv!item,
            operator: local!filterOperators[fv!index],
            value: if(
              contains(
                { "in", "not in" },
                local!filterOperators[fv!index][1]
              ),
              a!localVariables(
                local!indexData: local!filterValues[fv!index][1],
                if(
                  a!isNullOrEmpty(local!indexData),
                  local!filterValues[touniformstring(fv!index)][1],
                  local!indexData
                )
              ),
              local!filterValues[fv!index]
            )
          )
        ),
        ignoreFiltersWithEmptyValues: true
      ),
      fetchTotalCount: true(),
      pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 0)
    ),
    "totalCount",
    {}
  )
)

This is the error I am getting.
Expression evaluation error at function a!queryRecordType [line 25]: Invalid record field type mapping. No matching ADS type for appianTypeId: 252.

Thanks in Advance.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data