T
Twenty4mo ago
Upy

How to modify Default workspaces, fields, and data on new installation

Hello, my goal is to modify the default workspaces, fields, and sample data when I create a new installation of TwentyCRM. For example, the default workspaces are People, Opportunities, and Companies. I would like to add a few more workspaces. Secondly, I would like to modify the default fields within each of the new workspaces. Lastly, I need to remove the sample data from People, Companies, and Opportunities. Any guidance would be appreciated. It seems under twenty-server/src/engine/workspace-manager handles the creation of workspaces, and the default data. What is the difference between demo-objects vs standard objects in the workspace-manager? Is demo like the one from demo.twenty.com and standard would be if you did a local installation?
11 Replies
charles
charles4mo ago
Hi @Upy, this should be doable 🙂 The naming is not super clear in the moment in the code base but here are a few hints: - what you want is to change the "standard objects". It is currently also named "workspace.entity" in the code base. We are in the process of uniformizing it. By modifying this file you will change the standard data model or your workspaces (newly created workspaces, or existing workspaces by applying the "sync-metadata" command) - then regarding the sample data. We have two mechanism that are quite similar: seeding and prefilling. Seeding happens when you init Twenty for the first time and creates a dev workspaces or a demo workspaces if you run the demo seed command. You can just delete the dev workspace the first time and you won't hear about it anymore. Your issue (removing the sample data) is about the prefill one. The prefill mechanism happens whenever you create a new workspace. You can comment this logic in the workspaces creation logic
Upy
Upy4mo ago
regarding the workspace.entity (https://github.com/twentyhq/twenty/blob/08c081d315b0c4877559e20aa822a3c989a19c41/packages/twenty-server/src/engine/core-modules/workspace/workspace.entity.ts). that file appears to for the workspace(since it has. What i actually meant was for objects. ( i thought those were workspaces too). Currently, my plan is as follows: step 1 - ADD standard object id: Step one will be creating a uuid for each object. for example: export const STANDARD_OBJECT_IDS = { activityTarget: '20202020-2945-440e-8d1a-f84672d33d5e', medicalProvider: '20202020-8858-4dfe-8d1a-k896d35486' https://github.com/twentyhq/twenty/tree/08c081d315b0c4877559e20aa822a3c989a19c41/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants step 2 - define schema similar to this folder: https://github.com/twentyhq/twenty/tree/08c081d315b0c4877559e20aa822a3c989a19c41/packages/twenty-server/src/modules/person step 3 - add to workspace sync standard objects https://github.com/twentyhq/twenty/blob/08c081d315b0c4877559e20aa822a3c989a19c41/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/standard-objects/index.ts step 4 - figure out how to create these objects on workspace initialization????? (not sure here)
GitHub
twenty/packages/twenty-server/src/engine/workspace-manager/workspac...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
GitHub
twenty/packages/twenty-server/src/modules/person at 08c081d315b0c48...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
GitHub
twenty/packages/twenty-server/src/engine/workspace-manager/workspac...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
Upy
Upy4mo ago
i think you may be referring to @workspaceentity actually like this:
No description
Upy
Upy4mo ago
All, Here is my write up regarding initial data. Hope it helps explain some of the files: TypeORM Seed Data packages/twenty-server/src/database/typeorm-seeds During the local set up, the
npx nx database:reset twenty-server
npx nx database:reset twenty-server
command executes
workspace:seed:dev
workspace:seed:dev
from packages/twenty-server/src/database/commands/data-seed-dev-workspace.command.ts This creates 2 workspaces, Twenty and Apple which has 13 companies and 15 people. Standard Prefill Data When you create a brand new workspace (For example, after a google sign in, and get to name the workspace and everything), it populates the data from packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data There are only 5 people and 5 companies, so this wont need to be deleted/modified because it gives a good starting point. there is also a command that is Prefill Demo Data
workspace:seed:demo
workspace:seed:demo
Populates the data from packages/twenty-server/src/engine/workspace-manager/demo-objects-prefill-data. the demo data has a ton of data and is used for dev/testing.
charles
charles4mo ago
yes I'm talking about the @WorkspaceEntity your plan looks good. These existing worksapce entity (aka standard objects) are created when a new workspace is created or applied to existing workspaces while running the sync-metadata command!
Upy
Upy4mo ago
is there any other files that you think I will have to modify? and my last question is this for the newly generated objects ( specific to my application e.g. medical providers), do you think i should make these standard objects, or should they be custom objects? I plan on keeping people and companies as a contact list. but inherit their models for medical providers and doctors section. Just concerned if there will be any implications between standard objects vs custom
charles
charles4mo ago
standard object are provisionned with any new workspace. If it's only for your workspace (you are interacting with doctors), it's a use case for custom. standard is if you are trying to verticalize Twenty (you are selling to people interacting with doctors)
Upy
Upy4mo ago
makes sense, thank you so much @charles
charles
charles4mo ago
you are welcome!
JarWarren
JarWarren2mo ago
@Upy Did you end up getting this to work? And if so, could I take a look at your fork? I'd like to do something similar
Upy
Upy2mo ago
pmed
Want results from more Discord servers?
Add your server