How to save information about the user who creates the record in the database?

Let's take a task scheduling application as an example. The user can create a task in the app and assign it to himself.

Creating a data model

First, create a relationship between the task and user models. Choose the has_many relationship type since one user can have several tasks.

Setting up a business process

Go to the Business logic tab and create a new business process.

Use only the Auth: Get Current User block and create a variable of User type in the END block.

Endpoint setup

Let's set up the endpoint for the new BP. Go to the Endpoints tab and add a new one.

Set up:

1. Endpoint type – GET

2. URL – /currentuser/

3. Endpoint Groups – User

Now add the created BP to the creation of a new record. Check how to do it in this article.

Insert the created BP before the Make block and pass the user value from the Server request GET /currentuser/ to the Make block.

When creating a record, it will save the data about the user who created it.

AppMaster 101Crash Course

10 modules
2 weeks

Not sure where to start? Get going with our crash course for beginners and explore AppMaster from A to Z.

Get Started
AppMaster 101 Crash Course

Need More Help?

Solve any issue with the help of our experts. Save time and focus on building your applications.

headphones

Contact Support

Tell us about your problem, and we'll find you a solution.

message

Community Chat

Connect with other users to get help with platform.

Join Community