Validate existing fields on creation (#12057)
Fixes https://github.com/twentyhq/twenty/issues/12040 When fields are deleted but still used in workflows we do not update create record action settings. It breaks all following workflow execution and the user cannot update the settings anymore. This PR fixes the bug by filtering on existing fields. Next step will be to clean settings on field deletion. Adding it to fast follows. Also lowering throttle limit because some infinite loops are not catched.
This commit is contained in:
@ -987,7 +987,7 @@ export class ConfigVariables {
|
||||
type: ConfigVariableType.NUMBER,
|
||||
})
|
||||
@CastToPositiveNumber()
|
||||
WORKFLOW_EXEC_THROTTLE_LIMIT = 500;
|
||||
WORKFLOW_EXEC_THROTTLE_LIMIT = 100;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.RateLimiting,
|
||||
|
||||
@ -105,9 +105,15 @@ export class CreateRecordWorkflowAction implements WorkflowExecutor {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const validObjectRecord = Object.fromEntries(
|
||||
Object.entries(workflowActionInput.objectRecord).filter(
|
||||
([key]) => objectMetadataItemWithFieldsMaps.fieldsByName[key],
|
||||
),
|
||||
);
|
||||
|
||||
const transformedObjectRecord =
|
||||
await this.recordInputTransformerService.process({
|
||||
recordInput: workflowActionInput.objectRecord,
|
||||
recordInput: validObjectRecord,
|
||||
objectMetadataMapItem: objectMetadataItemWithFieldsMaps,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user