Best option to configure Branch Locations

What is the best way to setup Company Branch Locations? Each company may have multiple branch locations - the users for the company should be able to add/create new branches and be able to select from previously created branches. ie A user adds a new vehicle profile to the company and assigns a branch location - they can see previously created branches to select from and if not available add/assign a new branch location. Thanks.

Let’s assume you’ve got the following structure.

Data Tables:

  • Companies
  • Branches (Has a connection to Companies)
  • Users (Has a connection to Companies)
  • Vehicles (Has a connection Branches and to Companies)

So since each user has belongs to a company you can filter the branches to only show Branches connected to logged in user’s company. However, this doesn’t yet work on the form level. Meaning, inside the form you can’t add the same filters as you would inside a data source of a data component. You can then set the form to add new Vehicles inside a details page of a Branch. In short, they can only see branches for companies they belong to, once inside that branch they can add a new vehicle.

There is one way around this maybe.
In the form to add a new vehicle you have 3 fields:

  • Vehicle Name
  • Company
  • Branch

Inside the Company field set it to limit to companies that are connected to logged in user.

Next, in the Branches field, set it to only show Branches connected to this form’s Companies.

I hope this helps. Let me know if I can clarify anything further.

1 Like

I was dealing with same scenario yesterday, I like your suggestion Moe except if you are dealing with a user that is connected to only one company, it’s weird for them to have to select the company in a dropdown that only has one selection. Is there a way through javascript to have the first selection in the company dropdown selected and then maybe hide that element with css?

We have a record rule that automatically updates the company field based on the logged in users company so how would we make the above work.

Can you write Company to the user’s profile? Then you could work with that value as a value of the connected logged in user?