Can anyone advise how I can make it so my app only creates one listing per user? The app is a typical Air BNB style renting app. I have created the user (Owner) dashboard with a page for uploading the property listing. I created a workflow for the ‘Save’ button which creates the listing from the associated input fields on the page, which works fine. However if an owner tries to edit their listing (using the same page and save button) then it creates a new listing, which I don’t want to happen.
I have added an ‘only when expression’ to the Save button workflow eg: ‘Create a new listing ONLY WHEN current user’s listing is empty’ and the next step is ‘Make changes to Current User’s listing ONLY WHEN current user’s listing is NOT empty’.
But in both cases it creates a new listing.
Can anyone help please and advise what I am doing wrong and how to make it work?

Current User’s listing isn’t the best way to do this.

On your listing add a field called “Owner” and set the Current User as the owner.
THEN, in your search you search for “Listings where Owner = Current User is not empty”

You can also add the listing to the User, but I would not suggest it either. No need to store a listing and all it’s associated data on the User object.

Yes, you can use “Created By” field but any Bubbler worth his pay will tell you not to use that.

1 Like

Thanks very much, I appreciate the clear description of what to do. I will try it later today!

Can you clarify what you mean by:

in your search you search for “Listings where Owner = Current User is not empty

Where would the search take place, is it something that is done in the workflow if the save button?

Thanks

Just bumping this, can anyone out there help me with it?

A few things about this: (with brevity)

1 - the create listing button should be disabled if the user already has a listing (so no ‘create a thing’ workflow should be running if they already have an active listing)

2 - to determine if a User already has a listing; I propose that you should add a field to the Listing which is named “Owner” and you store the User whom created the Listing.

3 - On the User Object itself, you can store the “Current Listing”. (To make things easier for you as a beginner)

Anytime you need to check if the user has a current listing you can check “Current User: Current Listing is not empty” OR you can Do a search for Listing where Owner = Current User AND Status = Active

Once the listing is closed or inactivated; update the listing with a relevant status (closed or inactive) AND remove the Listing from the User Object . At this point, the [Create Listing] button should allow the user to create a new listing.

NEXT on the topic of Making Changes VS Creating a New Listing

Make your life easier by using a “SAVE” button for making changes and a “CREATE” button for creating new listing.

Use the conditions above to determine which button is relevant. For the save button (when modifying the listing) use the action “Make a change to” and select the relevant listing

can you walk me through how this is a different approach than “current user’s listing” which you outlined previously as a bad idea.

i fully agree that unnecessary data population is bad for businesses, but im having a hard time understanding how the search process works without some type of data.

also since this is an airbnb clone, it’s not like you’d be loading in a bunch of user data,. if that was the case, I could see using a satellite and antenna data container setup.

I think this poster is a beginner so I just used what they have is all.

I agree that to scale you can’t use this method. Using SATs is my go-to most of the time. I think this Builder needs to get some basics down first though; I didn’t want to over complicate things so I took a step back. After all; this is a pretty basic function.

agreed. @ncrushcov i would recommend implementing @hi.luisacosta’s solution as you’re gaining experience with the platform. however if you want to scale, you’re simply not going to have an efficient and fast app that has to use “do a search for” as it’s primary method of searching.

moreover, as Luis mentioned earlier, attaching that listing data directly to the user is bad long term design.

I would recommend checking out the OmniSearch plugin after you get your foot in the door. it’ll allow you to connect your database to typesense or algolia so that you can do really really fast searches without burning bubble resources.

also for your workflow, are you sure you’re actually saving the newly created listing directly to the user’s account via workflow? Creating a New Listing does not automatically link the listing.

Thanks for both of your input on this, I am still trying to process what you have explained so will post an update with my outcome soon!

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