function executeOnLoad()

in CDS.solutions/EducationAcceleratorCommon/Extracts/Base/WebResources/mshied_/Scripts/Forms/contact.js [21:43]


        function executeOnLoad(executionContext) {
            if (!executionContext) {
                return;
            }

            formContext = executionContext.getFormContext();

            contactTypeControl = formContext.getControl('mshied_contacttype'); // Lookup
            setupContactTypeOnChange();

            // Comparing the previous form loaded vs current form loading now, we can determine if a user (or contact type trigger) is changing the form
            // If this is the case, we do not try to force the correct form.
            // If the form name matches, or there is no previous form name, we can assume the user has just opened the record or refreshed,
            // and we want to force the correct form.
            var previousFormId = pageStorage.getItem(SESSION_PREVIOUS_FORM_KEY);
            var currentForm = formContext.ui.formSelector.getCurrentItem();
            if (currentForm) {
                pageStorage.setItem(SESSION_PREVIOUS_FORM_KEY, currentForm.getId());
            }
            if (!previousFormId || (currentForm && previousFormId === currentForm.getId())) {
                onContactTypeChange();
            }
        }