Scheduler Fields Dependent Properties

The scheduler field API has a few properties that will require some further explanation to be understood properly. These properties are the conditional or dependent properties, or the properties with names beginning with "dep". We will be creating an example here to clarify this for you.

First set of conditional fields: Conditional on a dataType DATE field

We have created an account to show you how the dependent fields interact. The first thing we will do for this purpose is add the scheduler field "Date of Birth", which is a default TimeTap field, to your list of client information fields. We then add two new fields called "First Field Dependent on Date of Birth" and "Second Field Dependent on Date of Birth". You can follow along on your own account if you'd like.
For the field "First Field Dependent on Date of Birth", we have set it up so that it will have the following values stored in the corresponding properties:
  • depFieldDefnId: 322521 - this means this field is dependent on the field with the schedulerPreferenceFieldDefnId of 322521 which has a dataType of DATE
  • depCondition: "LT" (stands for "Less Than") 
  • depValue: "6570"
  • depType: "AGE_FROM_APPT_DATE"
  • depAction: "DISABLE"
  • depSetValue: "Age Requirement Not Met"
  • depError: "You do not meet the requirements to answer this question"


Combining the settings of these properties together means that this field should behave a certain way depending on the value the person booking puts in the Date of Birth field (which in this case is schedulerPreferenceFieldDefnId 322521). Reading them together in a logical way, it means that IF someone puts a value in the field that has the ID 322521 (depFieldDefnId) that is LESS THAN (depCondition) 6570 (depValue) days from the DATE OF THE APPOINTMENT (depType) then DISABLE (depAction) this field (the "First Field Dependent on Date of Birth" field) and show the error message "You do not meet the requirements to answer this question" (depError) - then when the appointment is saved, save the field with the "value" property on the field set to "Age Requirement Not Met" (depSetValue). OTHERWISE, leave the field enabled to let them fill in whatever value they want.
For the field "Second Field Dependent on Date of Birth", you will see the following values stored in the dependent properties:
  • depFieldDefnId: 322521 - this means this field is dependent on the field with the schedulerPreferenceFieldDefnId of 322521 which has a dataType of DATE
  • depCondition: "LT" (stands for "Less Than") 
  • depValue: "6570"
  • depType: "AGE_FROM_TODAY"
  • depAction: "DISABLE"
  • depSetValue: "Age Requirement Not Met"
  • depError: "Since you are not 18 years old by the time you are booking, you cannot answer the "Second Field Dependent on Date of Birth""


Combining the settings of these properties together means that this field should behave a certain way depending on the value the person booking puts in the Date of Birth Field (schedulerPreferenceFieldDefnId 322521). Reading these property values together in a logical way, it means that IF someone puts a value in the field that has the ID 322521 (depFieldDefnId) that is LESS THAN (depCondition) 6570 (depValue) days from the DATE OF THE TIME THEY ARE BOOKING (depType) then DISABLE (depAction) this field (the "Second Field Dependent on Date of Birth" field) and show the error message "Since you are not 18 years old by the time you are booking, you cannot answer the "Second Field Dependent on Date of Birth"" (depError) - then when the appointment is saved, save the field with the "value" property on the field set to "Age Requirement Not Met" (depSetValue). OTHERWISE, leave the field enabled to let them fill in whatever value.
Now, let's look at this in action. If a client were to go to the scheduler for this account here on our personal booking page and go through to book an appointment, on the Your Information page the client can fill in the "Date of Birth" with a few different values. Depending on what they enter, the fields should respond a certain way.
Let's say this client goes through and selects to book at location "1234" with "Mr Biscuits" for "Running & Jumping". They join the class schedule for 9am on July 22nd. This would make the following conditions true:
  • If they put in a value of 07/22/1999 in the Date of Birth Field, then that would make the person already 18 at the time of booking and at the time of the appointment, thus both the "First Field Dependent on Date of Birth" and "Second Field Dependent on Date of Birth" should be enabled - see screenshot here: https://screencast.com/t/L3X86Ppuz9Y
  • If they put in a value of 07/15/2000 in the Date of Birth Field, then if the current day is 06/26/2018 that would mean the person is not yet 18 at the time of booking, but would be 18 at the time of the appointment. Thus the "First Field Dependent on Date of Birth" should be enabled and "Second Field Dependent on Date of Birth" should be disabled. The error message for the second field should show - see screenshot here: https://screencast.com/t/WN48uM2Bi
  • If they put in a value of 08/15/2000 in the Date of Birth Field, then if the current day is 06/26/2018 that would mean the person is not yet 18 at the time of booking and since the date of the appointment is July 22nd, then that person wouldn't be 18 at the time of the appointment either. Thus the "First Field Dependent on Date of Birth" and "Second Field Dependent on Date of Birth" should both be disabled, and both fields error messages should show - see screenshot here: https://screencast.com/t/ZZ5CSHjqe83l

Second set of conditional fields: Conditional on a dataType LIST field

The second thing we have done to show you how these dependent properties work is we have added the field "Which do you prefer" (schedulerPreferenceFieldDefnId 386794), which is of the dataType LIST and has "dancing", "singing", and "neither" as options. We then have added the scheduler fields "What's your favorite dance? (conditional on field "Which do you prefer")" and "What's your favorite song to sing? (conditional on field "Which do you prefer")". 

For the first field, "What's your favorite dance? (conditional on field "Which do you prefer")", we have stored the following values in the dependent properties:
  • depFieldDefnId: 386794 - this means this field is dependent on the field with the schedulerPreferenceFieldDefnId of 386794 which has a dataType of LIST
  • depCondition: "EQ" (stands for "Equal To") 
  • depValue: "Dancing"
  • depType: "EXACT"
  • depAction: "VISIBLE"
  • depSetValue: null
  • depError: null


For the second field, "What's your favorite song to sing? (conditional on field "Which do you prefer")", we have stored the following values in the dependent properties:
  • depFieldDefnId: 386794 - this means this field is dependent on the field with the schedulerPreferenceFieldDefnId of 386794 which has a dataType of LIST
  • depCondition: "EQ" (stands for "Equal To") 
  • depValue: "Singing"
  • depType: "EXACT"
  • depAction: "VISIBLE"
  • depSetValue: null
  • depError: null


Combining the settings of these properties together means the field should behave in a certain way depending on the value the client selects in the "Which do you prefer" dropdown (schedulerPreferenceFieldDefnId 386794). Reading these dependent property values together in a logical way, it means that IF someone picks a value in the field 386794 (depFieldDefnId) that EXACTLY (depType) EQUALS (depCondition) the value "Dancing" (depValue), then the text field "What's your favorite dance?" should be VISIBLE (depAction) and the field "What's your favorite song to sing" would not be shown because the conditions aren't meant. Otherwise IF someone picks a value in the field 386794 (depFieldDefnId) that EXACTLY (depType) EQUALS (depCondition) the value "Singing" (depValue), then the text field "What's your favorite song to sing?" should be VISIBLE (depAction) and the field "What's your favorite dance" would not be shown because the conditions aren't meant. OTHERWISE if neither "Singing" nor "Dancing" are selected and someone chose "Neither" as their option, then neither field would be showing.

Let's again go through and look at the scheduler's "Your Information" page during these scenarios:
  • Picks "Dancing" in the "Which do you prefer" field and the "What's your favorite dance" text field shows and the "What's your favorite song to sing" does not show: https://screencast.com/t/aUCEr5aG8
  • Picks "Singing" in the "Which do you prefer" field and the "What's your favorite song to sing" text field shows and the "What's your favorite dance" does not show: https://screencast.com/t/eJ6c7RooTjY7
  • Picks "Neither" in the "Which do you prefer" field and neither the "What's your favorite song to sing" nor the "What's your favorite dance" fields show: https://screencast.com/t/7O0uJ81fN

And there you have it! If you have any further questions please don't hesitate to contact our Customer Support team.