Contacts / Smart lists - Check all columns button
S
Scott H
Currently, if you export contacts out of Contacts / Smartlists, you only get the columns that are selected. And by default, you only get 5 fields. If you have an account with over 50 columns (dozens being custom fields), you have to check each checkbox in order to get them added to the list before you can export.If you manage many accounts or simply want to select all your data before exporting, this becomes a lengthy task. Having a "Check All" columns button would easily fix this. Or having a saved preference option for the columns you like to see by default, would be awesome.
HIGHLVL-I-3535
Log In
H
Hans Lange
!!! Or having a saved preference option for the columns you like to see by default, would be awesome.... 100% agree and needed
K
Keith Fimreite
Here is some custom JS that should work.
<script>
//watches for page / slug changes
const crmObserver = new MutationObserver(function (mutations) {
if (location.href !== crmPrevUrl) {
crmPrevUrl = location.href;
waitForElementToDisplay('.hl_nav-header', function () { //.hl_nav-header is for regular site .hl_nav-header-without-footer is for admin settings
ShowSelectAllContact();
}, 100, 9000);
}
});
crmObserver.observe(document, {subtree: true, childList: true});
function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
var startTimeInMs = Date.now();
(function loopSearch() {
if (document.querySelector(selector) != null) {
callback();
return;
} else {
setTimeout(function () {
if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs)
return;
loopSearch();
}, checkFrequencyInMs);
}
})();
}
function ShowSelectAllContact() {
waitForElementToDisplay('[aria-labelledby="colViewButton"]', function () {
// Access the container of the checkboxes
var selectViewContainer = document.querySelector('[aria-labelledby="colViewButton"]');
var selectAllContact = document.querySelector('#selectAllContact');
if (selectAllContact) return; // Prevents adding another 'Select All' if it already exists
if (selectViewContainer) {
// Create the 'Select All' checkbox element
const selectAllCheckbox = document.createElement('input');
selectAllCheckbox.type = 'checkbox';
selectAllCheckbox.id = 'selectAllContact';
selectAllCheckbox.classList.add('focus:ring-curious-blue-500', 'h-5', 'w-5', 'text-curious-blue-600', 'border-gray-300', 'rounded', 'mr-2');
// Create a label for the 'Select All' checkbox
const label = document.createElement('label');
label.htmlFor = 'selectAllContact';
label.textContent = ' Select All';
// Create a container for the new checkbox
const div = document.createElement('div');
div.classList.add('mx-3', 'mb-2');
div.appendChild(selectAllCheckbox);
div.appendChild(label);
// Insert the new checkbox at the top of the list
selectViewContainer.insertBefore(div, selectViewContainer.firstChild);
// Event listener for the 'Select All' checkbox
selectAllCheckbox.addEventListener('change', function () {
// Query all checkboxes except 'selectAllContact' and 'name'
const checkboxes = selectViewContainer.querySelectorAll('input[type="checkbox"]:not(#selectAllContact):not(#name)');
// Set each checkbox's checked state to match the 'Select All' checkbox
checkboxes.forEach((checkbox) => {
if (checkbox.checked !== this.checked) {
checkbox.checked = this.checked;
// Dispatch a 'change' event to each checkbox
try {
const event = new Event('change', { bubbles: true });
checkbox.dispatchEvent(event);
} catch (e) {
console.error('Error dispatching event: ', e);
}
}
});
});
}
}, 250, 9000);
}
</script>
H
Hans Lange
Keith Fimreite that is great. Do you have an idea how to modify that so you can save a selection of columns which is predefined? Like Button 1: column with custom field 1, 2, 5, 7 ... New Button: custom field 1.5.7. In this meaning....
S
Scott H
Currently, if you export contacts out of Contacts / Smartlists, you only get the columns that are selected. And by default, you only get 5 fields. If you have an account with over 50 columns (dozens being custom fields), you have to check each checkbox in order to get them added to the list before you can export.If you manage many accounts or simply want to select all your data before exporting, this becomes a lengthy task. Having a "Check All" columns button would easily fix this. Or having a saved preference option for the columns you like to see by default, would be awesome.