From c62bd396f7da2a0171cd143caa6a0e63d9425aae Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 3 Dec 2025 20:49:56 +0530 Subject: [PATCH] fix(Workflow): Search bar to select object is not working as expected (#16255) Fixes Issue: #16188 **Bug:** Object Selection Dropdown was not working correctly when searching by object's name. This was happening only when `Search Records` action is selected. Other actions(Create, Delete, Update, Upsert) were working correclty(object search was working). **Reason:** `Search Records` action uses `WorkflowObjectDropdownContent` component which only filters based on `nameSingular` field in metadata (and doesnt search based on lable text). All other record action uses the `Select` component which filters by the label property (set to `labelProperty`). **Fix:** Updated the filtering logic of `WorkflowObjectDropdownContent` component to match the search text with label field also. I could't find any unit tests for the `WorkflowObjectDropdownContent` component (or any other component in workflow module). Let me know if I missed it and if tests need to be added for this. **Screenshot of working object search in Search Record** image --- .../WorkflowObjectDropdownContent.tsx | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) 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 7ec3e27d85..d80e5e8f2c 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