function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlinaAlina 

How to create Validation rule, prohibiting the creation of appointment with a Doctor, if Working Hours Start > Working Hours End;

Best Answer chosen by Alina
Khan AnasKhan Anas (Salesforce Developers) 
Hi Alina,

Greetings to you!

First, create two fields with Time data type, say, Start Working Hours and End Working Hours.
Then use below validation rule:
Start_Working_Hours__c > End_Working_Hours__c

Please refer to the below links which might help you further with the validation rules.

https://trailhead.salesforce.com/en/content/learn/modules/point_click_business_logic/validation_rules

https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5 (https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Rounak SharmaRounak Sharma

hi Alina,
You can approach by creating two fields one will be Start time and other will be the end time. then in appointment field put the validation as start time < end time or what ever is your requirement.

Please let me know if it helped you in any way.
Thanks and regards
Rounak

Khan AnasKhan Anas (Salesforce Developers) 
Hi Alina,

Greetings to you!

First, create two fields with Time data type, say, Start Working Hours and End Working Hours.
Then use below validation rule:
Start_Working_Hours__c > End_Working_Hours__c

Please refer to the below links which might help you further with the validation rules.

https://trailhead.salesforce.com/en/content/learn/modules/point_click_business_logic/validation_rules

https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5 (https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Sai Charan Bhupathi VenkataSai Charan Bhupathi Venkata
I have created 2 sobjects(patient and doctor). I have created 2 time fields in doctor for start and end time fo his work. Now I created an appointment time filed in patient to select a time he wants to go with the selected doctor. My task is to create a validation so that if the selected time is not in the start and end of doctor hours the validation should trigger. How can I approach this.