Default values for relationships

It seems to be impossible to set default values for a relationship.
I have the following simple scenario:
A user has a relation to the collection ROLE which just holds three values:

  • Client
  • Doctor
  • Administrator

I want to set the default user role “Client” during or directly after the signup of a new user.
It works setting the role via a form. But I need to do it in the background.
I don’t get this to work. Any help would be highly appreciated.

You can set fields of a form automatically in the background.
Try this, I think this could solve your problem

In my case, instead of creating a separate collection for user’s role, I instead just add a field in Users Collection named “User Type”. I can fill that User Type with a text such as doctor, client, administrator.

Let say later on we want to create 2 buttons that is 1 button will show only to the user with User Type doctor, and the other will show only to the user with User Type client.

then we can simply filter our users with :

  • column User Type contains someKeyword (for example doctor)

We can play with visibility, filter, or conditional actions.

Also you can set automatic field when user sign up for adding those User Type field.

@projectlinuxsupports: I tried this already and I can set a “hardcoded” default value for an invisible text field. But this is kind of ugly. These are only workarounds, but no easy way to control the available values in a lookup list. A pretty basic requirement from my PoV.


Agreed, this is going to be a popular feature request. The proper way to handle this is with a separate table and the ability to assign the automatic field value to a foreign key in that table (in your case, the role table). Please add your vote here as others have already identified the need for this feature:

How about have an invisible dropdown menu on the sign up page, set the default to be Client, and on the signup button field, after signing up the user, add an update action>logged in user> role > form input > the invisible dropdown menu.

@karimoo This tutorial walks you through how to do it:

This process does not seem to work for signing a user up and updating the database with a default status.

It should work fine. Can you post some screenshots how you have set it up?

Hi all, I have the same problem.
These are my 2 tables:

Table1 with Id, Name and Status fields
Table2 with Id and Name fields

Status field of Table1 is linked to Table2 and when I create a new record of Table1 I would set default value as 1 in Status field. But I see only “empty” value in automatic field setting and I can’t change it

I also tried to set update action after the creation of the new record but I can’t understand how set the value