Tech Resources
[Add-on]: Prevent Reapply & Recently Scheduled
In order to implement this Add-On, make sure to:
1. Push the Template Snapshot:
Push the following:
- Custom Fields:
- [Scheduling Disqualifiers]
- [Reapply Disqualifiers]
- Workflows
- [Add-On]: Recently Applied/Scheduled
2. Edit the following within the Subaccount:
Forms
- Update [Calendar Sign-up (In Person)] & [Calendar Sign-up (Virtual)] Forms to include [Scheduling Disqualifiers] Custom Field as Hidden
- Must have hidden value set to {{ contact.scheduling_disqualifiers }}
Calendars
- Change Form on Calendar to the appropriate [Calendar Sign-up] form
- Move Form above Schedule option within Calendar Editor
Scheduling Pages
- Add the Javascript below to each Scheduling Page’s [ </> Tracking Code ]:
<script>
// Function to check the value of the disqualifier input and modify the calendar and video within the same row
function checkDisqualifierAndModifyPage() {
// Select the radio input field with data-q="scheduling disqualifiers" and value="DNQ"
const disqualifierInput = document.querySelector('input[data-q="scheduling disqualifiers"]:checked');
// Check if the input field exists and if its value is "DNQ"
if (disqualifierInput && (disqualifierInput.value === "DNQ" || disqualifierInput.value === "Recently Scheduled")) {
console.log("Scheduling Disqualifier input found, modifying the page...");
// Find the calendar widget element
const calendarWidget = document.querySelector('.c-calendar');
if (calendarWidget) {
// Get the closest parent row of the calendar
const parentRow = calendarWidget.closest('.c-row');
// Replace the calendar widget with the custom message
calendarWidget.innerHTML = `
<div style="padding-top: 80px;">
<h3 style="margin-bottom: 20px;"><b>It seems we're unable to schedule an interview with you at this time.</b></h3>
<p style="font-size: 20px;">Please try again at a later date.</p>
</div>`;
calendarWidget.style.textAlign = 'center'; // Optional: Center the message
// Find the video within the same parent row and hide it
const videoContainer = parentRow.querySelector('.video-container');
if (videoContainer) {
videoContainer.style.display = 'none'; // Hide the video element
console.log("Video container hidden successfully.");
}
}
}
}
// Intercept fetch to detect when form data is loaded
(function() {
const originalFetch = window.fetch;
window.fetch = function(...args) {
return originalFetch.apply(this, args)
.then(response => {
// After any fetch request, run the disqualifier check with a 1-second delay
console.log('Fetch request completed:', args);
response.clone().json().then(data => {
console.log('Data fetched:', data);
// After data is fetched, wait for 1 second, then check the disqualifier
setTimeout(checkDisqualifierAndModifyPage, 2000); // 1-second delay
}).catch(error => {
console.warn('Failed to parse fetch response:', error);
});
return response;
});
};
})();
</script>