Read Only Grid Sort Error - invalid field identifer

Hello,

 I'm doing a simple read only grid with the source from a a!QueryRecordType to my record type. The issue I have is when I try to setup the sort I get an invalid field identifier error. I tried removing the column in the record type and add it back in but I get the same error but with a different identifier ID.

Here is my code 

a!gridField(
label: "Read-only Grid",
labelPosition: "ABOVE",
data:rule!ISM_QueryTop20PublishedDocuments(),
columns: {
a!gridColumn(
label: "Documentid",
sortField: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}documentid',
value: fv!row['recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}documentid']
),

},
validations: {}
)

Here is the error i get

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = ae593:697dc] : An error occurred while executing a save: Expression evaluation error at function fn!error [line 114]: Invalid field identifier: "#"urn:appian:record-field:v1:6c3f65fe-917f-4366-b480-020d7dbaa2e0/30e1db97-bb69-4765-a270-0e6592c6a736""

A previous user only updated the default filter but undid their changes after testing.

  Discussion posts and replies are publicly visible

Parents
  • In this case my assumption is that your data rule is not returning 'RecordData' via a!recordData(), rather a datasubset via a!queryEntity()? I can reproduce the error with that configuration in my environment.

    If so, this should work for you instead by referencing the id field name directly:

    a!gridField(
      label: "Read-only Grid",
      labelPosition: "ABOVE",
      data:rule!ISM_QueryTop20PublishedDocuments(),
      columns: {
        a!gridColumn(
          label: "Documentid",
          sortField: "documentid",
          value: fv!row["documentid"]
        ),
    
      },
      validations: {}
    )

    Essentially, the recordType!YourRecord references will only work when the data input to the grid is of type RecordData.

    Let us know if that resolves.

    Also to note, feel free to utilize the INSERT -> CODE feature when posting SAIL snippets for code readability:

Reply
  • In this case my assumption is that your data rule is not returning 'RecordData' via a!recordData(), rather a datasubset via a!queryEntity()? I can reproduce the error with that configuration in my environment.

    If so, this should work for you instead by referencing the id field name directly:

    a!gridField(
      label: "Read-only Grid",
      labelPosition: "ABOVE",
      data:rule!ISM_QueryTop20PublishedDocuments(),
      columns: {
        a!gridColumn(
          label: "Documentid",
          sortField: "documentid",
          value: fv!row["documentid"]
        ),
    
      },
      validations: {}
    )

    Essentially, the recordType!YourRecord references will only work when the data input to the grid is of type RecordData.

    Let us know if that resolves.

    Also to note, feel free to utilize the INSERT -> CODE feature when posting SAIL snippets for code readability:

Children
  • Chris thanks but the query is using a!QueryRecordType and returning the same record type i'm referencing in the columns. Here is the code for it.

    a!localVariables(
      local!defaulttenantid: rule!ISM_QueryUserDetailsByLoggedInUser().defaultTenantId,
      a!queryRecordType(
        recordType: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord',  
        filters: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{19694294-4d17-4f57-bf8c-9e276b6b0c19}tenantid',
              operator: "in",
              value: tointeger(local!defaulttenantid)
            ),
            a!queryFilter(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{2e70e4e8-e64e-4129-81d2-e5544dbea906}status',
              operator: "=",
              value: "Published"
            )
          }
        ),    
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 20,
          sort: {
            a!sortInfo(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{3d41b5a7-43bb-4f85-add3-ba683c213e0d}publishdate',
              ascending: false
            ),
            a!sortInfo(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}ISM DocumentRecord.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}documentid',
              ascending: false
            )
          }
        ),
        fetchTotalCount: false()
      ).data
    )

  • Gotcha.  In that case the error may be related to having paging essentially hard coded into the data rule, as this can cause confusion as you page and sort the grid after load.  If we move this to the grid's initialSorts and pageSize parameters, you may be good to go by utilizing a!recordData also (in lieu of a!queryRecordType).

    Try this in your environment - I combined the grid and data rule into one interface and also moved the local!defaulttenantid definition to outside the grid data evaluation so it will not have to re-evaluate on each sort (performance), should be able to paste and go:

    a!localVariables(
      local!defaulttenantid: rule!ISM_QueryUserDetailsByLoggedInUser().defaultTenantId,
      a!gridField(
        label: "Read-only Grid",
        labelPosition: "ABOVE",
        data: a!recordData(
          recordType: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}',  
          filters: {
            a!queryFilter(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{19694294-4d17-4f57-bf8c-9e276b6b0c19}',
              operator: "in",
              value: tointeger(local!defaulttenantid)
            ),
            a!queryFilter(
              field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{2e70e4e8-e64e-4129-81d2-e5544dbea906}',
              operator: "=",
              value: "Published"
            )
          }
        ),
        initialSorts: {
          a!sortInfo(
            field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{3d41b5a7-43bb-4f85-add3-ba683c213e0d}',
            ascending: false
          ),
          a!sortInfo(
            field: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}',
            ascending: false
          )
        },
        pageSize: 20,
        columns: {
          a!gridColumn(
            label: "Documentid",
            sortField: 'recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}',
            value: fv!row['recordType!{6c3f65fe-917f-4366-b480-020d7dbaa2e0}.fields.{30e1db97-bb69-4765-a270-0e6592c6a736}']
          ),
      
        },
        validations: {}
      )
    )

  • Chris,

     Thanks this did work I'm going to apply the logic to the interface to verify

  • Great!  For the other record type, if you continue to get errors on it feel free to post a new thread with the details and we'll take a look.