Open Bonapara opened 1 month ago
To refactor the feature to be linked with Required relationships
, follow these steps:
Update RecordBoardColumnNewOpportunityButton.tsx
:
Modify the handleEntitySelect
function to handle required relationships.
const handleEntitySelect = (company?: EntityForSelect) => {
setIsCreatingCard(false);
goBackToPreviousHotkeyScope();
resetSearchFilter();
if (!company) {
return;
}
// Add logic to handle required relationships
const requiredRelations = getRequiredRelations(); // Implement this function
createOneRecord({
name: company.name,
companyId: company.id,
position: 'last',
...requiredRelations,
});
};
Update RelationPicker.tsx
:
const handleEntitySelected = (selectedEntity: EntityForSelect | null | undefined) => {
onSubmit(selectedEntity ?? null);
// Add logic to handle required relationships
const requiredRelations = getRequiredRelations(); // Implement this function
persistField({ ...selectedEntity?.record, ...requiredRelations });
};
Implement getRequiredRelations
function:
const getRequiredRelations = () => {
// Logic to fetch required relationships
return {
relationField1: value1,
relationField2: value2,
};
};
Ensure SettingsObjectNewFieldStep2
handles required relationships:
const handleSubmit = () => {
const requiredRelations = getRequiredRelations(); // Implement this function
createMetadataField({ ...formData, ...requiredRelations });
};
/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunityButton.tsx /packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx /packages/twenty-front/src/modules/object-record/relation-picker/components/RelationPicker.tsx /packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationToOneFieldInput.tsx /packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField
@Bonapara Sorry I couldn't understand what exactly is required in the desired behaviour. Could you please explain a bit further.
Hi @Faisal-imtiyaz123, unfortunately, this issue is not ready to be picked up. It's here to log the issue, but we have not decided on a solution yet. Thanks!
Current Behavior
When creating an opportunity from the Opportunity Kanban board:
When creating a record on a regular Kanban board:
Desired Behavior
We should either:
Required relationships