Grab user-email from dropdown of names

I’m building a messenger.

There are two types in use: Messages, and Users (to grab the send-to name).

How can I grab the destination-user’s email after selecting the their name in a dropdown?

Thanks very much.
Chris!

44|690x412

This is covered in the basic video tutorials when you sign up to Bubble.

I don’t see that it is. So I’d like to ask again, in case this is different than you’ve assumed.

I have a user type which includes the user’s first_last field and the user’s email.

And I have a message type, to save messages.

I’m writing a message, and when I save it, I want to save the message with that other user’s email as the recipient.

But I’m selecting the message recipient, that other user by a dropdown that shows just the other users’ first_last, and it isn’t unique.

When I save the message, I don’t see anyway of selecting the focused user record (from the dropdown) and picking up and saving the other user’s email to the message type.

Sorry if I’m slow.

Hi there,

Need some further screenshots as to the current workflows for the page and also the data types you have setup.

You can always access ‘current users x’ or ‘things creators’ as a dynamic expression and even use the ‘result of step x’ to grab a workflow action thing to save to another matching data type.

If for instance you have a data type called ‘Message’ that is a thing and then on the ‘User’ data type you have a list of ‘Messages’, then you can reference the dropdown when creating a new ‘Message’ to get the ‘User’ object e.g. simple example below:

image


The ‘Creator’ field will be automatically added by Bubble from the current user

Luke, thanks very much.

You can search for users where message contains xxxx user’s email

Okay I think I understand the setup. In this case, I’d just save the ‘user’ object into the ‘message’ data type. You’ll then have access to all the fields within that ‘user’ object e.g. fields for name, email and so on.

I assume that the dropdown is setup to be a dynamic list of choices like the example below:
image

When you make a selection on the dropdown, it will be selecting the whole ‘user’ object as a data type. You can then pass this and save to whatever data type you want.

So for instance on the ‘Message’ data type, you can have a field like so…
image

Then its simply a case of when you create a new thing, being the ‘Message’ data type, you can add the whole ‘user’ object data type to that field to get stored and later you can reference anywhere the email and other fields within workflow events, actions and API workflows…

Example here, I’ve selected on the dropdown a user object:
image

Then on the Send button I have a workflow event, when clicked perform these actions…
image

Then presumably you’d want to add that ‘Message’ just created to a ‘User’, must likely the ‘User’ logged into the site who is creating these messages.

Before we test, you might want to check that in your ‘App Data’ you have the ‘Primary Fields’ set to something more friendly to reference
e.g.image

Here is the result of the new entry, when clicking the ‘SEND’ button in the data type ‘Message’:
image!
The ‘User to Message’ has stored the ‘User’ object that can be referenced as mentioned. The ‘Created by’ would again be a ‘User’ object that you can reference in the same way, but I wasn’t logged into an account, so Bubble cannot track this

Hope this helps and makes sense.

Created by > Sent to both contain a user.

Thanks very much, Luke. Got it. Just what I needed. Chris

Great, glad to shed some light onto the subject. There are many ways to tackle this sort of messenger workflow, but as mentioned, as long as you store the ‘User’ object, you’ll be able to reference in later expressions or workflows.