//This JavaScript code only allows the Claimant field, on the New Claims form, to be changed if the form is New

function claimantNewForm() {

    //get formtype
    var formType = window.parent.Xrm.Page.ui.getFormType();

    if (formType != 1) { //check to see if the form is not new
        window.parent.Xrm.Page.getControl('btsss_claimant').setDisabled(true);//disables the Appointment field
    }

}


// This JavaScript code clears all appointment related fields on the New Claims form when the Claimant changes

function clearAppointmentFields() {

    var appointment = '';
    var appointmentDate = '';
    var appointmentFacility = '';

    //clears the appointment related fields
    window.parent.Xrm.Page.getAttribute("btsss_appointmentid").setValue(appointment);
    window.parent.Xrm.Page.getAttribute("btsss_appointmentdatetime").setValue(appointmentDate);
    window.parent.Xrm.Page.getAttribute("btsss_facilityid").setValue(appointmentFacility);

}