Skip to content

The open alternative to Salesforce, designed for AI.

Search record schema migration breaks following workflow steps (#14833)

Thomas Trompette3fa12bb9fc70
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx
index 57ac4bccf00..974282c4029 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx
@@ -229,28 +229,34 @@ export const WorkflowDropdownStepOutputItems = ({
{filteredOptions.length > 0 && shouldDisplaySubStepObject && (
<DropdownMenuSeparator />
)}
- {filteredOptions.map(([key, subStep]) => (
- <MenuItemSelect
- key={key}
- selected={false}
- focused={false}
- onClick={() => handleSelectField(key)}
- text={subStep.label || key}
- hasSubMenu={!subStep.isLeaf}
- LeftIcon={
- subStep.icon
- ? getIcon(subStep.icon)
- : getIcon(
- getStepItemIcon({
- itemType: subStep.type,
- }),
- )
- }
- contextualText={
- subStep.isLeaf ? subStep?.value?.toString() : undefined
- }
- />
- ))}
+ {filteredOptions.map(([key, subStep]) => {
+ if (!isDefined(subStep)) {
+ return null;
+ }
+
+ return (
+ <MenuItemSelect
+ key={key}
+ selected={false}
+ focused={false}
+ onClick={() => handleSelectField(key)}
+ text={subStep.label || key}
+ hasSubMenu={!subStep.isLeaf}
+ LeftIcon={
+ subStep.icon
+ ? getIcon(subStep.icon)
+ : getIcon(
+ getStepItemIcon({
+ itemType: subStep.type,
+ }),
+ )
+ }
+ contextualText={
+ subStep.isLeaf ? subStep?.value?.toString() : undefined
+ }
+ />
+ );
+ })}
</DropdownMenuItemsContainer>
</DropdownContent>
);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx
index 8b40cff6fab..d5afe47f7cb 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx
@@ -136,28 +136,34 @@ export const WorkflowVariablesDropdownStepItems = ({
{filteredOptions.length > 0 && shouldDisplaySubStepObject && (
<DropdownMenuSeparator />
)}
- {filteredOptions.map(([key, subStep]) => (
- <MenuItemSelect
- key={key}
- selected={false}
- focused={false}
- onClick={() => handleSelectField(key)}
- text={subStep.label || key}
- hasSubMenu={!subStep.isLeaf}
- LeftIcon={
- subStep.icon
- ? getIcon(subStep.icon)
- : getIcon(
- getStepItemIcon({
- itemType: subStep.type,
- }),
- )
- }
- contextualText={
- subStep.isLeaf ? subStep?.value?.toString() : undefined
- }
- />
- ))}
+ {filteredOptions.map(([key, subStep]) => {
+ if (!isDefined(subStep)) {
+ return null;
+ }
+
+ return (
+ <MenuItemSelect
+ key={key}
+ selected={false}
+ focused={false}
+ onClick={() => handleSelectField(key)}
+ text={subStep.label || key}
+ hasSubMenu={!subStep.isLeaf}
+ LeftIcon={
+ subStep.icon
+ ? getIcon(subStep.icon)
+ : getIcon(
+ getStepItemIcon({
+ itemType: subStep.type,
+ }),
+ )
+ }
+ contextualText={
+ subStep.isLeaf ? subStep?.value?.toString() : undefined
+ }
+ />
+ );
+ })}
</DropdownMenuItemsContainer>
</DropdownContent>
);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts
index 4510724cca7..5afdec89742 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts
@@ -104,6 +104,10 @@ const filterBaseOutputSchema = ({
for (const key in outputSchema) {
const field = outputSchema[key];
+ if (!isDefined(field)) {
+ continue;
+ }
+
if (field.isLeaf) {
if (isFieldTypeCompatibleWithRecordId(field.type)) {
filteredSchema[key] = field;