Removing a user from a company

A user belongs to many companies and a company has many users, but I’m trying to remove the currently logged in user from a particular company and then refresh the home page with the list of current companies that user belongs to (and make the current company disappear). Because the currently logged in user is removing him/herself from said company, there is a modal window in between asking if the user is sure about removing himself from the company. I’m guessing the modal page needs to have access to the companies collection, which currently only shows options for the current user or logged in user. How can I both remove the current user from the current company and then refresh the home (dashboard) page company list? Thanks in advance for any suggestions!

You have to update the user, to remove him from that company

Hi @marisa

You’re correct. You could have a list showing all of the companies the logged in user is a member of. When they select a company (ex. you can have a delete icon in the list that when selected opens to modal) and then you’ll update the current record removing the logged in user.

Best,
Erik

Thanks for you reply, Erik, but I’m still lost. If you have a chance, would you mind taking a look at the app so far?

Do you have a login we can use to test it?

Also it would be great if you could post a video walking through your backend setup so we can see where things might be breaking. You can use Loom easily enough to record the video.

Hey Tony, I tried signing in but it does not work

About the question you asked - to delete the User from the company:

  1. Update Current Company - REMOVE Logged In User

this should be enough

Thank you all so much for all the prompt help! One of the accounts you can use to log in is test@me.com, pw: testing. By backend setup, do you mean the db collections? “Blanks” collection is one that we don’t know why it’s there, but apparently something breaks if you remove it. I didn’t set those up myself, but I’ll work on creating a walkthrough video.

OK, so it seems like the (-) is not actually removing the user. So if you can do a video that walks us through how you have things setup in the Adalo Editor for that button and returning to the main screen we can probably get this figured. I’d guess that if you look at that (-) you don’t have a UPDATE set that Removes current user from company, or removes Company from User.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.