Forum Academy Marketplace Showcase Pricing Features

Passing search result as data to a page

I have a standard Bubble sign in/logon page. After a user logs on, I want to take him to his Organization page. Let’s say that Organization has a members field, which is a list of users’ emails.

So after the logon action, I add the action: Go to Page and set the destination to Organization. For Data to Send, I need to pass a reference to an Organization. So I choose, Do a Search For. Up until now, I think I’m OK. But at this point I get confused.

Now I have the Data to Send field, but I also have a new dialog, called Do a Search For. I think they are the same thing, so in the new dialog, under Type, I choose Organization. This gets filled into the Data to Send field too. Great. Now do I add a new constraint in the new dialog, or click More in the first dialog? Or is it the same thing again?

I want to find the organization that has an entry in its list of members (which is a list of email addresses) that matches the email address of this user, who I guess is now the Current User.

I tried:
Search for Organization’s Member’s email contains Current User’s email
Search for Organization’s Members contains Current User
and a few other possibilities, but nothing worked. The criteria remained red.

So…should I be entering criteria in the second dialog? And either way, what is the right search string? Or am I going about this all wrong?

Many thanks,
mark

Hi Mark,

Try the following for data to send: search for an organization with a constraint > members contains current user. And after the search click “more” to add the “:first item” modifier.

“Do a search for” will always return a list result and even behave like a list result even when you know there is only 1 match, so in order to single it down to 1 item, you need to specify that you want the “First item” that matches. In your case, you know that only 1 org will match, so you don’t need to worry about which item is returned; it will always be the “first” since the list returned will always be a list of 1.

That’s why all your attempts result in incompatible errors; a page with a data type expects 1 record and you haven’t specified a single record yet… When you do the following:

“Search for Organization’s Member’s email contains Current User’s email”

That actually returns a yes/no. You’d want to have the email or member constraint in the criteria constraint and have it just be "search for org : first item.

An alternative, and probably easier way, to do this is to have an “organization field” under the User to save that record to their record. So that when you log them in (you’re correct, as soon as that happens they are now Current User), you can just pass the org data this way: current user’s organization.

Hope this helps.


Gaby | Coaching Bubble

1 Like