Link data of 2 users + display in repeating group - Please Help

Hello Bubblers,

I am creating an app with 2 different users; employer and employee.

The employee logs in and “creates a new project” in his/her dashboard.
The employer logs in and he/she has to be able to see a list of all the projects of his/her employees.

When they both log in, they enter their work email.
So I want to link the employer WITH all the projects of all his employees BY THE DOMAIN NAME of the company. So that the projects of all his employees are displayed in a repeating group.

What I did:
I created a repeating group with type of content “PROJECT”. (in dashboard of employer)
Data source: “search for projects”
MY QUESTION IS: How do I formulate the CONSTRAINT ??
So that the DOMAIN NAME of the employees project corresponds with the domain name of the current user (the employer) ??

Can anybody please help me?

In the employer you could create a data type linked_employees. Set that to be type = user and make it a list.

Now the employee can do a search for linked_employees projects.

I think that should work, let me know if it doesnt and i’ll try to help. I was really struggling with an issue like this as few days ago but once you get your head around how bubble links data it gets easier (promise!)

Thank you so much for your reply!
Can I share a link with you so you can have a look in the app?
I don’t know if everything is set correctly in order o do what you suggested…

I’m fairly new at Bubble and trying my best to learn it :smiley:
Thank you so much in advance !

Yep sure, go for it!

Can you see the changes i made now? I havent shared an app here before so i dont know how to do it!

I made 3 users. Bill and Bob and employees.
I made 4 projects, then i added 2 of these to each user. I changed the primary search field for project the the name of the project rather than the unique ID.
The repeating group shows all linked_employees’ projects. I put in some sample text outputs for you.

Is that what you needed?

Thank you for helping me out !!

How did you “link” the employees to the employer?
What do you mean by “changed the primary search field for project the the name of the project rather than the unique ID”?

What I need the app to do is:
1/ an employee of a certain company creates an account and then creates a project in his dashboard
(once the employee made the project an email is sent to the employer informing that an employee of his company has made a project)
2/ This employer goed to the website and also needs tp create an account and then he has an overview of the projects of his employee(s) (in his dashboard)
– LINK: they should be linked by the fact that they have the same domain name in their emailadress…

Is this possible?
How can this be achieved?

I’ll do my best to explain it but i’m new here too so I might use the wrong terminology.

When you create a new field can pick the “type” of data. I picked user and made the field a list (of users).

Every bit of data in bubble has a long and complicated unique ID, when you want to add a project to a user its much easier for you to add “eat burger” than it is for you to add a long ID that you dont recognise.

If you click on app data there is a button called primary fields. This lets you pick how you search for a field. Its unique ID by default but I normally pick the field that makes sense to me - searching project by name for example.

Regarding your questions - that should be doable.

Why do you need to link via the domain? Can you set it up so the employer creates an account first?

ok, now I understand the primary fields…

I want the app to AUTOMATICALLY link an employer to an employee (for example via the domain of the email) because the employee should be able to create an account (and a project) before his employer has an account…

So for example, an employee of a certain company creates a project, then an email is automatically send to the employer (employee has given the emailaddress of his employer before submitting the project)
The employer then creates an account and then in his dashboard there is an AUTOMATICAL link to the employees project because they share the same domain name in the emailadress

do you know how to achieve this?

You made a field “linked employees” and this is a list of users…
But how did you link the 2 users to the employer?

I would suggest that when a user creates an account you ask them if they are an employer or an employee. If they are an employee then you can probably get bubble to split their email input into username@“” but for now you could just ask them to enter their company web address.

In terms of checking and your workflow you might want to create a new data type, Companies. This would have a list of managers (users) and a list of employees (users). When anyone signs up you will need to check to see if their company exists and if it does you add them to that thing - if not you create a new one. All sounds simple but i’m not 100% sure how to do it off the top of my head.

Have a go - I’ll check back later and try to help if i can!

1 Like

Also - I linked them manually. I went into the user record (employer) and added the employees to him.

Aaaah ok, now I see how you did it… You did it manually
This would be a very good way of doing so, if the employer creates an account and then the employees are added to the employer…

I will try and have a go on how to work out the new data type, companies…
Yes, it sounds simple and logic, but how to implement it?

Thank you so so much for your help so far and the new insights :smiley:

This topic was automatically closed after 70 days. New replies are no longer allowed.