Our company has specific appointment windows of 8am to 12pm, 12pm to 4pm and 4pm to 8pm. No matter how many times I tell people to only select these options in our Start and End Times for Appointments they still select others.
답변 1개
Hi Joshua, Below is the validation rule for your case
OR(
Start_Date_Time__c > End_Date_Time__c ,
AND(
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))>=8,
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))<12,
NOT(VALUE(MID(TEXT(End_Date_Time__c -TZOffset/24), 12, 2))<12)
)
,
AND(
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))>=12,
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))<16,
NOT(VALUE(MID(TEXT(End_Date_Time__c -TZOffset/24), 12, 2))<16)
),
AND(
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))>=16,
VALUE(MID(TEXT(Start_Date_Time__c -TZOffset/24), 12, 2))<20,
NOT(VALUE(MID(TEXT(End_Date_Time__c -TZOffset/24), 12, 2))<20)
)
)
Replace TZOffset value according to your time zone. e.g For Easter Daylight Time(America/New_York), it should be "-4".