Files
twenty/packages/twenty-shared/src/workflow/index.ts
T
Thomas Trompette e81fdbcc7a feat(workflow): variable pickers for Search Records limit, offset and date filters (#23696)
## Summary

<img width="491" height="390" alt="Capture d’écran 2026-08-03 à 11 30
40"
src="https://github.com/user-attachments/assets/6db59b8a-3e8e-41b8-80b3-c736e56b7f7f"
/>

Adds workflow variable pickers to the **Search Records** action for
fields that previously only accepted static values:

- **Limit** and **Offset** number inputs now expose the
`WorkflowVariablePicker`, so they can be bound to a variable from a
previous step. The stored value can be a standalone variable string; the
backend coerces the resolved value back to a number.
- **Date filters** using the `Is before` (`IS_BEFORE`) and `Is after or
equal` (`IS_AFTER`) operands now expose the variable picker in the
advanced filter side panel (previously disabled for all date filters).

The backend already resolves these inputs via `resolveInput`; the only
backend change is a small numeric coercion of the resolved limit/offset.

## Changes

- `WorkflowEditActionFindRecords.tsx` — pass `WorkflowVariablePicker` to
the Limit/Offset inputs; make `onChange` and form state variable-aware
(`number | string`).
- `AdvancedFilterSidePanelValueFormInput.tsx` — enable the date
`VariablePicker` only for `IS_BEFORE` / `IS_AFTER`.
- `useGetRecordFilterDisplayValue.ts` — return the raw variable for a
standalone `{{variable}}` value so date filters don't crash
`Temporal.*.from`.
- `find-records-action-settings-schema.ts` — allow a string (variable)
for `limit` / `offset`.
- `find-records.workflow-action.ts` — coerce resolved `limit` / `offset`
to numbers before querying.

## Testing

Built a workflow locally (Manual trigger → Code step returning `{ limit:
2, offset: 1, sinceDate }` → Search Records) with all three fields bound
to those variables. The run completed successfully; the Search Records
step returned exactly 2 records (limit applied) filtered by `createdAt
>= sinceDate`, confirming the backend resolves each variable.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/23696?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. -->
2026-08-03 12:32:06 +00:00

214 lines
12 KiB
TypeScript

/*
* _____ _
*|_ _|_ _____ _ __ | |_ _ _
* | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
* | | \ V V / __/ | | | |_| |_| | Any edits to this will be overridden
* |_| \_/\_/ \___|_| |_|\__|\__, |
* |___/
*/
export { CAPTURE_ALL_VARIABLE_TAG_INNER_REGEX } from './constants/CaptureAllVariableTagInnerRegex';
export { CONTENT_TYPE_VALUES_HTTP_REQUEST } from './constants/ContentTypeValuesHttpRequest';
export { IF_ELSE_BRANCH_POSITION_OFFSETS } from './constants/IfElseBranchPositionOffsets';
export { OBJECTS_BLOCKED_FROM_AUTOMATION } from './constants/ObjectsBlockedFromAutomation';
export { TRIGGER_STEP_ID } from './constants/TriggerStepId';
export { WORKFLOW_TRIGGER_METADATA_KEY } from './constants/WorkflowTriggerMetadataKey';
export { WORKFLOW_TRIGGER_METADATA_LABEL } from './constants/WorkflowTriggerMetadataLabel';
export { WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_KEY } from './constants/WorkflowTriggerMetadataWorkspaceMemberIdKey';
export { WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_LABEL } from './constants/WorkflowTriggerMetadataWorkspaceMemberIdLabel';
export { WORKFLOW_TRIGGER_PAYLOAD_KEY } from './constants/WorkflowTriggerPayloadKey';
export { WORKFLOW_TRIGGER_RECORD_LABEL } from './constants/WorkflowTriggerRecordLabel';
export { WORKFLOW_TRIGGER_RECORDS_LABEL } from './constants/WorkflowTriggerRecordsLabel';
export { WORKFLOW_DIAGRAM_DEFAULT_NODE_DIMENSIONS } from './layout/constants/WorkflowDiagramDefaultNodeDimensions';
export { WORKFLOW_LAYOUT_DEFAULT_OPTIONS } from './layout/constants/WorkflowLayoutDefaultOptions';
export type {
WorkflowLayoutNode,
WorkflowLayoutEdge,
WorkflowLayoutPosition,
WorkflowLayoutOptions,
} from './layout/utils/compute-workflow-layout.util';
export { computeWorkflowLayout } from './layout/utils/compute-workflow-layout.util';
export { workflowAiAgentActionSchema } from './schemas/ai-agent-action-schema';
export { workflowAiAgentActionSettingsSchema } from './schemas/ai-agent-action-settings-schema';
export { baseTriggerSchema } from './schemas/base-trigger-schema';
export { baseWorkflowActionSchema } from './schemas/base-workflow-action-schema';
export { baseWorkflowActionSettingsSchema } from './schemas/base-workflow-action-settings-schema';
export { workflowCodeActionSchema } from './schemas/code-action-schema';
export { workflowCodeActionSettingsSchema } from './schemas/code-action-settings-schema';
export { workflowCreateCalendarEventActionSchema } from './schemas/create-calendar-event-action-schema';
export { workflowCreateCalendarEventActionSettingsSchema } from './schemas/create-calendar-event-action-settings-schema';
export { workflowCreateRecordActionSchema } from './schemas/create-record-action-schema';
export { workflowCreateRecordActionSettingsSchema } from './schemas/create-record-action-settings-schema';
export { workflowCronTriggerSchema } from './schemas/cron-trigger-schema';
export { workflowDatabaseEventTriggerSchema } from './schemas/database-event-trigger-schema';
export { workflowDeleteRecordActionSchema } from './schemas/delete-record-action-schema';
export { workflowDeleteRecordActionSettingsSchema } from './schemas/delete-record-action-settings-schema';
export { workflowDraftEmailActionSchema } from './schemas/draft-email-action-schema';
export { workflowEmptyActionSchema } from './schemas/empty-action-schema';
export { workflowEmptyActionSettingsSchema } from './schemas/empty-action-settings-schema';
export { expectedOutputSchemaShape } from './schemas/expected-output-schema-shape';
export { workflowFilterActionSchema } from './schemas/filter-action-schema';
export { workflowFilterActionSettingsSchema } from './schemas/filter-action-settings-schema';
export { workflowFindRecordsActionSchema } from './schemas/find-records-action-schema';
export { workflowFindRecordsActionSettingsSchema } from './schemas/find-records-action-settings-schema';
export { workflowFormActionSchema } from './schemas/form-action-schema';
export { workflowFormActionSettingsSchema } from './schemas/form-action-settings-schema';
export { workflowHttpRequestActionSchema } from './schemas/http-request-action-schema';
export { workflowHttpRequestActionSettingsSchema } from './schemas/http-request-action-settings-schema';
export { workflowIfElseActionSchema } from './schemas/if-else-action-schema';
export {
stepIfElseBranchSchema,
workflowIfElseActionSettingsSchema,
} from './schemas/if-else-action-settings-schema';
export { workflowIteratorActionSchema } from './schemas/iterator-action-schema';
export { workflowIteratorActionSettingsSchema } from './schemas/iterator-action-settings-schema';
export { workflowLogicFunctionActionSchema } from './schemas/logic-function-action-schema';
export { workflowLogicFunctionActionSettingsSchema } from './schemas/logic-function-action-settings-schema';
export { workflowManualTriggerSchema } from './schemas/manual-trigger-schema';
export { objectRecordSchema } from './schemas/object-record-schema';
export { workflowPickRecordActionSchema } from './schemas/pick-record-action-schema';
export {
workflowPickRecordStrategySchema,
workflowPickRecordActionSettingsSchema,
} from './schemas/pick-record-action-settings-schema';
export { workflowSendEmailActionSchema } from './schemas/send-email-action-schema';
export type { WorkflowEmailFiles } from './schemas/send-email-action-settings-schema';
export {
workflowEmailFilesSchema,
workflowSendEmailActionSettingsSchema,
} from './schemas/send-email-action-settings-schema';
export { stepFilterGroupSchema } from './schemas/step-filter-group-schema';
export { stepFilterSchema } from './schemas/step-filter-schema';
export { workflowUpdateRecordActionSchema } from './schemas/update-record-action-schema';
export { workflowUpdateRecordActionSettingsSchema } from './schemas/update-record-action-settings-schema';
export { workflowUpsertRecordActionSchema } from './schemas/upsert-record-action-schema';
export { workflowUpsertRecordActionSettingsSchema } from './schemas/upsert-record-action-settings-schema';
export { workflowWebhookTriggerSchema } from './schemas/webhook-trigger-schema';
export { workflowActionSchema } from './schemas/workflow-action-schema';
export { workflowDelayActionSchema } from './schemas/workflow-delay-action-schema';
export { workflowDelayActionSettingsSchema } from './schemas/workflow-delay-action-settings-schema';
export { workflowFileSchema } from './schemas/workflow-file-action-schema';
export { workflowRunSchema } from './schemas/workflow-run-schema';
export { workflowRunStateSchema } from './schemas/workflow-run-state-schema';
export { workflowRunStateStepInfoSchema } from './schemas/workflow-run-state-step-info-schema';
export { workflowRunStateStepInfosSchema } from './schemas/workflow-run-state-step-infos-schema';
export { workflowRunStatusSchema } from './schemas/workflow-run-status-schema';
export {
workflowRunStepLogSchema,
workflowRunStepLogsSchema,
} from './schemas/workflow-run-step-log-schema';
export { workflowRunStepStatusSchema } from './schemas/workflow-run-step-status-schema';
export { workflowTriggerSchema } from './schemas/workflow-trigger-schema';
export { workflowVariableReferenceSchema } from './schemas/workflow-variable-reference-schema';
export type { EmailRecipients } from './types/EmailRecipients';
export type { FunctionInput } from './types/FunctionInput';
export type {
RecordSchemaType,
InputSchemaPropertyType,
InputSchemaProperty,
InputSchema,
} from './types/InputSchema';
export type { StepIfElseBranch } from './types/StepIfElseBranch';
export { WorkflowActionType } from './types/WorkflowActionType';
export type { WorkflowAttachment } from './types/WorkflowAttachment';
export type { BodyType } from './types/workflowHttpRequestStep';
export type {
WorkflowRunStepInfo,
WorkflowRunStepInfos,
} from './types/WorkflowRunStateStepInfos';
export { StepStatus } from './types/WorkflowRunStateStepInfos';
export type {
WorkflowRunStepLog,
WorkflowRunStepLogs,
AiAgentStepLogDetails,
AiToolCallLog,
} from './types/WorkflowRunStepLog';
export { canObjectBeManagedByAutomation } from './utils/canObjectBeManagedByAutomation';
export { extractRawVariableNamePart } from './utils/extractRawVariableNameParts';
export { getFunctionInputFromInputSchema } from './utils/getFunctionInputFromInputSchema';
export { getWorkflowRunContext } from './utils/getWorkflowRunContext';
export { parseBooleanFromStringValue } from './utils/parseBooleanFromStringValue';
export { parseDataFromContentType } from './utils/parseDataFromContentType';
export {
needsEscaping,
escapePathSegment,
joinVariablePath,
parseVariablePath,
} from './utils/variable-path.util';
export { isIfElseStepInput } from './validation/guards/isIfElseStepInput';
export { isIteratorStepInput } from './validation/guards/isIteratorStepInput';
export type {
IfElseStepInput,
IteratorStepInput,
WorkflowValidationSeverity,
WorkflowValidationIssueCode,
WorkflowValidationIssue,
WorkflowValidationResult,
ValidatableWorkflowStep,
ValidatableWorkflowTrigger,
ValidatableWorkflow,
} from './validation/types/workflow-validation.type';
export type { WorkflowGraph } from './validation/utils/build-workflow-graph.util';
export { buildWorkflowGraph } from './validation/utils/build-workflow-graph.util';
export { extractVariablesFromInput } from './validation/utils/extract-variables-from-input.util';
export { getEditDistance } from './validation/utils/get-edit-distance.util';
export {
getStepInput,
getStepOutgoingStepIds,
} from './validation/utils/get-step-outgoing-step-ids.util';
export { getVariablePathSuggestions } from './validation/utils/get-variable-path-suggestions.util';
export { validateWorkflowGraph } from './validation/utils/validate-workflow-graph.util';
export { validateWorkflowStepParams } from './validation/utils/validate-workflow-step-params.util';
export { validateWorkflowVariableReferences } from './validation/utils/validate-workflow-variable-references.util';
export { validateWorkflowStructure } from './validation/validate-workflow-structure.util';
export { isBaseOutputSchemaV2 } from './workflow-schema/guards/isBaseOutputSchemaV2';
export type {
LeafType,
NodeType,
Leaf,
Node,
BaseOutputSchemaV2,
} from './workflow-schema/types/base-output-schema.type';
export type {
RecordFieldLeaf,
RecordFieldNode,
RecordFieldNodeValue,
FieldOutputSchemaV2,
RecordOutputSchemaV2,
RecordNode,
FindRecordsOutputSchema,
IteratorOutputSchema,
FormFieldLeaf,
FormFieldNode,
FormOutputSchema,
LinkOutputSchema,
CodeOutputSchema,
ManualTriggerOutputSchema,
OutputSchemaV2,
VariableSearchResult,
} from './workflow-schema/types/output-schema.type';
export { buildManualTriggerMetadataNode } from './workflow-schema/utils/build-manual-trigger-metadata-node';
export { collectOutputSchemaPaths } from './workflow-schema/utils/collect-output-schema-paths';
export type { OutputSchemaPathFailure } from './workflow-schema/utils/find-output-schema-path-failure';
export { findOutputSchemaPathFailure } from './workflow-schema/utils/find-output-schema-path-failure';
export {
isFlattenedArrayOutputSchema,
getCurrentItemSchemaFromFlattenedArrayOutputSchema,
} from './workflow-schema/utils/flattened-array-output-schema';
export { navigateOutputSchemaProperty } from './workflow-schema/utils/navigate-output-schema-property';
export type { ResolvedVariable } from './workflow-schema/utils/resolve-variable-path-in-output-schema';
export {
resolveInSchema,
resolveVariablePathInOutputSchema,
collectOutputSchemaVariablePaths,
} from './workflow-schema/utils/resolve-variable-path-in-output-schema';
export {
searchRecordOutputSchema,
searchVariableInOutputSchema,
} from './workflow-schema/utils/search-variable-in-output-schema';
export type {
GlobalAvailability,
SingleRecordAvailability,
BulkRecordsAvailability,
} from './workflow-trigger/types/workflow-trigger.type';