Open martmull opened 1 month ago
To implement custom code execution, follow these steps:
Identify the Hook or Component for Custom Code Execution:
RecordTableWithWrappers.tsx
located at /packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx
.useTimelineActivities.ts
located at /packages/twenty-front/src/modules/activities/timeline/hooks/useTimelineActivities.ts
.Add Custom Code Execution Logic:
RecordTableWithWrappers.tsx
, you can add custom logic within the handleUpdate
or handleDelete
functions.
const handleUpdate = useRecoilCallback(
({ set }) => async (recordId: string, fieldMetadata: FieldMetadata, value: any) => {
// Custom code execution logic here
console.log('Custom code execution before update');
await updateRecordMutation({ recordId, fieldMetadata, value });
set(RecordUpdateContext, { recordId, fieldMetadata, value });
},
[updateRecordMutation]
);
useTimelineActivities.ts
, you can add custom logic within the useEffect
or useFindManyRecords
hooks.
useEffect(() => {
// Custom code execution logic here
console.log('Custom code execution on targetable object change');
set(objectShowPageTargetableObjectState, targetableObject);
}, [targetableObject]);
Ensure Proper State Management:
useNavigationSection.ts
located at /packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts
.
const { closeNavigationSection, openNavigationSection } = useNavigationSection(scopeId);
// Custom code execution logic here
console.log('Custom code execution in navigation section');
/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWithWrappers.tsx /packages/twenty-front/src/modules/activities/timeline/hooks/useTimelineActivities.ts /packages/twenty-server/src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator.ts /packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts /packages/twenty-front/src/modules/object-record/record-filter/utils/isRecordMatchingFilter.ts /packages/twenty-server/src/engine/api/graphql/workspace-query-builder/factories/args-string.factory.ts /packages/twenty-server/src/engine/api/graphql/workspace-schema-storage/workspace-schema-storage.service.ts /packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts /packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordFieldInput.ts /packages/twenty-server/src/engine/twenty-orm/twenty-orm.module.ts