Need help with this logic

I have three main objects. Appointments, Users, and Salons. There are many Users and many Salons. Users create Appointments to Salons. I have a form Users will use to create Appointments. I need to create a page rule for that form as follows: If count of Appointments to Salon(x) is >10 for Logged-in User, then page rule creates warning message.

How do I count how many appointments have been made a a specific Salon by user?

Hi Victor:

You can create a relation between users -> appointments, each user have many appointments, with this relation create a field type COUNT and create a flag field, (like multiple choice or Yes/No), and in the "condition rule" of the field, you set that, if the count of the appointments its < than 11 then flag = "Yes" else Flag = "No".

In the form, at the rules, set if users.flag = "No" send a message and hide a view.

Greetings and luck!

 

Each Salon has many Customers.

Add another field to Salon object with number type.Create new Salon and add max number of customers allowed in that field number.

In User Object create a field formula that count how many Customers Related to the Salons.

In Customer page view appointment form , create a rule that compare the Customer total and Salon allowed number.If the Customer total is above the max Customer per Salon total Then hide the form and set a warning message to the customer that the appointment is full.

Hope this will help