Skip to content

The open alternative to Salesforce, designed for AI.

fix(Workflow): Search bar to select object is not working as expected (#16255)

Abhishek Kumarc62bd396f7da
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowObjectDropdownContent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowObjectDropdownContent.tsx
index 7ec3e27d855..d80e5e8f2c7 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowObjectDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowObjectDropdownContent.tsx
@@ -35,24 +35,39 @@ export const WorkflowObjectDropdownContent = ({
objectMetadataItem.isActive && objectMetadataItem.isSystem,
);
+ const matchesSearchFilter = (
+ objectMetadataItem: (typeof objectMetadataItems)[number],
+ searchInputLowerCase: string,
+ ) => {
+ return (
+ objectMetadataItem.nameSingular
+ .toLowerCase()
+ .includes(searchInputLowerCase) ||
+ objectMetadataItem.labelSingular
+ .toLowerCase()
+ .includes(searchInputLowerCase) ||
+ objectMetadataItem.labelPlural
+ .toLowerCase()
+ .includes(searchInputLowerCase)
+ );
+ };
+
+ const searchInputLowerCase = searchInputValue.toLowerCase();
+
const shouldShowAdvanced =
showAdvancedOption &&
!isSystemObjectsOpen &&
(!isNonEmptyString(searchInputValue) ||
- searchInputValue.toLowerCase().includes('advanced'));
+ searchInputLowerCase.includes('advanced'));
const filteredNonSystemObjects = nonSystemObjectMetadataItems.filter(
(objectMetadataItem) =>
- objectMetadataItem.nameSingular
- .toLowerCase()
- .includes(searchInputValue.toLowerCase()),
+ matchesSearchFilter(objectMetadataItem, searchInputLowerCase),
);
const filteredSystemObjects = systemObjectMetadataItems.filter(
(objectMetadataItem) =>
- objectMetadataItem.nameSingular
- .toLowerCase()
- .includes(searchInputValue.toLowerCase()),
+ matchesSearchFilter(objectMetadataItem, searchInputLowerCase),
);
const filteredObjects = isSystemObjectsOpen