﻿<html>

<head>
    <meta charset="utf-8" />
</head>

<body onload="clearCaregvier()">

    <!--This JavaScript code checks to see if the opened form's form type is new (new record is being created) and, if so, clears out the caregiver field.
        This is to fix a bug where the caregiver field has the same default value as the claimant field on the New Claims form.-->
    <script type="text/javascript">

        function clearCaregvier() {

            var caregiver = "";
            var formType = window.parent.Xrm.Page.ui.getFormType();
            //alert(formType);
                        
            if (formType == 1) { //formType of 1 is a new form
                window.parent.Xrm.Page.getAttribute("btsss_caregiver").setValue(caregiver); //clear caregvier field
            }           

        }

    </script>

</body>

</html>