feat(front): allow advanced relation fields in FieldWidget selector (#22005)

## After

<img width="706" height="760" alt="image"
src="https://github.com/user-attachments/assets/d118285f-baab-4187-988c-d0180d61a629"
/>
<img width="707" height="372" alt="image"
src="https://github.com/user-attachments/assets/5676d829-2ec1-494e-a8f0-5998f1f0c3c8"
/>


## Summary

The FieldWidget field-selection dropdown currently filters out relation
fields whose target is a system object, so users can't pick fields like
`calendarEventParticipants` on the CalendarEvent record page. The widget
itself can render them just fine as boxed relations — the restriction
only lives in the picker.

This unblocks the consistency story from #22003 (revert of #21857): once
shipped, participants can be added to the calendar event record page via
the existing FieldWidget mechanism instead of a bespoke side-panel page.

## Changes

- `isFieldCellSupported`: adds an opt-in `includeSystemObjectRelations`
option that skips the `isObjectMetadataAvailableForRelation` system
check.
- `useFieldListFieldMetadataItems`: forwards the option through to
`isFieldCellSupported`. Default is `false`, so all existing callers keep
current behavior.
- `useFieldWidgetEligibleFields`: turns the option on, so the
FieldWidget selector now surfaces fields like
`calendarEventParticipants`, `messageParticipants`, etc.

## Test plan

- [x] `nx typecheck twenty-front`
- [x] `nx lint:diff-with-main twenty-front`
- [ ] CI
- [ ] Manually verify the FieldWidget dropdown now lists
`calendarEventParticipants` on a CalendarEvent record page, and that
selecting it renders a participants list via the existing relation
card/field widget.

https://claude.ai/code/session_01RnMcjL35wdCRzpXN257RLJ

---
_Generated by [Claude
Code](https://claude.ai/code/session_01RnMcjL35wdCRzpXN257RLJ)_

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22005?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
martmull
2026-06-24 10:30:42 +02:00
committed by GitHub
parent f98f514640
commit 269c8ef400
8 changed files with 135 additions and 26 deletions
@@ -0,0 +1,12 @@
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { isFieldCellSupported } from '@/object-record/utils/isFieldCellSupported';
export const isAdvancedRelationFieldMetadataItem = (
fieldMetadataItem: FieldMetadataItem,
objectMetadataItems: EnrichedObjectMetadataItem[],
) =>
!isFieldCellSupported(fieldMetadataItem, objectMetadataItems) &&
isFieldCellSupported(fieldMetadataItem, objectMetadataItems, {
includeSystemObjectRelations: true,
});
@@ -5,9 +5,14 @@ import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField
import { isObjectMetadataAvailableForRelation } from '@/object-metadata/utils/isObjectMetadataAvailableForRelation';
import { FieldMetadataType } from '~/generated-metadata/graphql';
type IsFieldCellSupportedOptions = {
includeSystemObjectRelations?: boolean;
};
export const isFieldCellSupported = (
fieldMetadataItem: FieldMetadataItem,
objectMetadataItems: EnrichedObjectMetadataItem[],
options: IsFieldCellSupportedOptions = {},
) => {
if (fieldMetadataItem.type === FieldMetadataType.POSITION) {
return false;
@@ -40,9 +45,12 @@ export const isFieldCellSupported = (
return true;
}
if (!fieldMetadataItem.relation || !relationObjectMetadataItem) {
return false;
}
if (
!fieldMetadataItem.relation ||
!relationObjectMetadataItem ||
!options.includeSystemObjectRelations &&
!isObjectMetadataAvailableForRelation(relationObjectMetadataItem)
) {
return false;