SORTING PROBLEM

Cannot sort by field because it is from a one-to-many record relationship.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • i tried that one but it is not sorting in read only grid

  • 0
    Certified Lead Developer
    in reply to cyasodhac0315

    Can you share the relevant code snippets of that grid and the query?

  • a!localVariables(
    local!data:a!queryRecordType(
    recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
    fields: {
    /*Fields from the Case record type*/
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{1b3b9b1b-3d00-451d-a526-b3cd13aa6f53}tuitionSchool',

    /*Related fields from the invoice record type*/
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency'
    },
    relatedRecordData: {
    /*Only return related cases that have a priority of critical*/
    a!relatedRecordData(
    relationship: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices',
    sort: {
    a!sortInfo(
    field:'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
    ascending: true()
    )
    }
    )
    },
    filters: {
    a!queryFilter(
    field: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}PSLM SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',

    operator: "not in",
    value: a!queryRecordType(
    recordType: 'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices',
    pagingInfo: a!pagingInfo(1, 500)
    ).data['recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{b6be991f-0f5b-448b-8d6e-a1ea4c80a229}spedCaseDeatils']
    )
    },
    pagingInfo: a!pagingInfo(
    startindex: 1,
    batchSize: 500
    )
    ).data,
    a!gridField(
    label: "Employees",
    data:local!data,

    columns: {
    a!gridColumn(
    label: "Case Name",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}PSLM SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
    value: a!linkField(
    links: {
    a!recordLink(
    label: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber'],
    recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
    identifier: fv!identifier
    )
    }
    )
    ),
    a!gridColumn(
    label: "School",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6} SPEDCaseFields.fields.{1b3b9b1b-3d00-451d-a526-b3cd13aa6f53}tuitionSchool',
    value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{1b3b9b1b-3d00-451d-a526-b3cd13aa6f53}tuitionSchool']
    ),
    a!gridColumn(
    label: "Student Name",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{56aa80de-28c6-4a04-b754-8cce3c3c64e8}People2.fields.{86ad75e9-5ee6-47ca-b60e-1ac48d90a6e8}lastFirstName',
    value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{56aa80de-28c6-4a04-b754-8cce3c3c64e8}People2.fields.{86ad75e9-5ee6-47ca-b60e-1ac48d90a6e8}lastFirstName']
    ),
    a!gridColumn(
    label: "Opposing Counsel",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{c3c82eb7-53ca-4908-bd3a-fc5fd40f041c}opposingCounsel',
    value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{c3c82eb7-53ca-4908-bd3a-fc5fd40f041c}opposingCounsel']
    ),
    a!gridColumn(
    label: "Amount",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
    value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency']
    )
    }
    ))

  • a!localVariables(
    local!data:a!queryRecordType(
    recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
    fields: {
    /*Fields from the Customer record type*/
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{1b3b9b1b-3d00-451d-a526-b3cd13aa6f53}tuitionSchool',

    /*Related fields from the Case record type*/
    'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency'
    },
    relatedRecordData: {

    a!relatedRecordData(
    relationship: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices',
    sort: {
    a!sortInfo(
    field:'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
    ascending: true()
    )
    }
    )
    },
    filters: {
    a!queryFilter(
    field: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6} SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',

    operator: "not in",
    value: a!queryRecordType(
    recordType: 'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices',
    pagingInfo: a!pagingInfo(1, 500)
    ).data['recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{b6be991f-0f5b-448b-8d6e-a1ea4c80a229}spedCaseDeatils']
    )
    },
    pagingInfo: a!pagingInfo(
    startindex: 1,
    batchSize: 500
    )
    ).data,
    a!gridField(
    label: "Employees",
    data:local!data,

    columns: {
    a!gridColumn(
    label: "Case Name",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
    value: a!linkField(
    links: {
    a!recordLink(
    label: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6} SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber'],
    recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
    identifier: fv!identifier
    )
    }
    )
    ),

    a!gridColumn(
    label: "Amount",
    sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
    value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency']
    )
    }
    ))

  • 0
    Certified Lead Developer
    in reply to cyasodhac0315

    For better readability, can you please format it and insert it as a code? 

  • a!localVariables(
      local!data: a!queryRecordType(
        recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
        fields: {
          'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
          'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{1b3b9b1b-3d00-451d-a526-b3cd13aa6f53}tuitionSchool',
          'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency'
        },
        relatedRecordData: {
          a!relatedRecordData(
            relationship: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices',
            sort: {
              a!sortInfo(
                field: 'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
                ascending: true()
              )
            }
          )
        },
        filters: {
          a!queryFilter(
            field: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
            operator: "not in",
            value: a!queryRecordType(
              recordType: 'recordType!{f0767469-1f37-4b95-b313-d6e2d4358512} Invoices',
              pagingInfo: a!pagingInfo(1, 500)
            ).data['recordType!{f0767469-1f37-4b95-b313-d6e2d4358512}Invoices.fields.{b6be991f-0f5b-448b-8d6e-a1ea4c80a229}spedCaseDeatils']
          )
        },
        pagingInfo: a!pagingInfo(startindex: 1, batchSize: 500)
      ).data,
      a!gridField(
        label: "Employees",
        data: local!data,
        columns: {
          a!gridColumn(
            label: "Case Name",
            sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber',
            value: a!linkField(
              links: {
                a!recordLink(
                  label: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.fields.{f3b7727f-0c13-4ca2-aa04-893bd743453b}SPED_CaseNameNumber'],
                  recordType: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields',
                  identifier: fv!identifier
                )
              }
            )
          ),
          a!gridColumn(
            label: "Amount",
            sortField: 'recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency',
            value: fv!row['recordType!{4d9165a3-338c-4f95-bcec-48792442acf6}SPEDCaseFields.relationships.{cfb4d68e-3047-4d8e-987c-f6a40423945b}Invoices.fields.{c982fabf-aea5-4a18-b554-6495cd1aec2e}currency']
          )
        }
      )
    )