Update record in database
Hello everyone, I’m trying to implement a reminder feature for tasks and would like to know how I can insert a value into the database. I’ve already created the fields but I can’t manage to insert the data into the database...
6 Replies
Hi @Marcos Beraldo, glad you are playing with Twenty 🙂
to be more aligned with how Twenty works here is what I would do:
- create a reminderDelay SELECT field ("NONE" | "SAME_DAY" | "ONE_DAY_BEFORE" | "TWO_DAYS_BEFORE") (standard field, you can edit task.workspace-entity.ts)
- create a reminderAt DATE field (standard field, you can edit task.workspace-entity.ts)
- display reminderOption on the view itself (you'll be able to edit its value using the existing UI
- add a listener on task.updated in the code (you'll find some example in the code base) that updates reminderAt based on reminderDelay and dueAt
- create a cronJob to check reminderAt and send some emails or whatever you want to do
I confess that I'm struggling a bit to learn how to use Twenty 😅 . Anyway, thank you for responding, I'll try to implement these steps very soon.
It's not easy at the moment and we are not documenting a lot. As things keep getting more mature, we will provide how to guides 🙂
I'll close this one for now, feel free to re-open it if you need more help
Hello again @charles! Your step-by-step guide gave me a better understanding of how the project works, but I still haven't been able to achieve the result I'd like... I need to know how to add this listener to my select component so that it updates the database and shows the value. Currently, when I close the calendar and reopen it, it loses the value I selected for the reminder
@Marcos Beraldo would you have a branch to share with me, I could guide you more precisely from there
I sent you a DM