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

I am getting this error "Cannot sort by field [teamMemberId] because it is from a one-to-many record relationship." when trying to apply sort field gridcoloumn

a!gridColumn(
label: "Members",
sortField:recordType!WFM RID.relationships.wfmRIDmember.fields.MemberId
value: count(
fv!row['recordType!WFM RID.relationships.wfmRIDmember.fields.MemberId']
)




  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    The code you've shared doesn't logically work.  First your value is a count of "MemberId", implying that the value shown on a given cell in the grid will be the total number of MemberIds associated with the "wfmRIDmember" on that row.  I assume that would be fine, assuming that's what you want to be showing.

    But then, what would sorting by "MemberId" even be expected to do?  Each row of your grid has its own set of MemberIds, for one thing, so sorting on those is not meaningful, let alone not possible.

    In this case it's probably best to just not add a sort field to the grid column. Not all columns require sortability.

Reply
  • 0
    Certified Lead Developer

    The code you've shared doesn't logically work.  First your value is a count of "MemberId", implying that the value shown on a given cell in the grid will be the total number of MemberIds associated with the "wfmRIDmember" on that row.  I assume that would be fine, assuming that's what you want to be showing.

    But then, what would sorting by "MemberId" even be expected to do?  Each row of your grid has its own set of MemberIds, for one thing, so sorting on those is not meaningful, let alone not possible.

    In this case it's probably best to just not add a sort field to the grid column. Not all columns require sortability.

Children