Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created October 23, 2017 19:09
Show Gist options
  • Save matthewpoer/1ad17a046bb64f322020ac96ffcfa809 to your computer and use it in GitHub Desktop.
Save matthewpoer/1ad17a046bb64f322020ac96ffcfa809 to your computer and use it in GitHub Desktop.
SFDC Set History Tracking for all fields. Natively the UI only allows you to de-select all fields. This JS will invert the native function and select all of the fields on the screen. Note that SFDC only allows 20 fields to be tracked, so you may have to manually remove some before saving.
// copy the text out of the native function
var selectAll = selectNone.toString();
// replace "checked=false" with "checked=true"
selectAll = selectAll.replace(/checked=false/g, 'checked=true');
// rename the function
selectAll = selectAll.replace(/function selectNone/g, 'function selectAll');
// the text var selectAll now contains a new function, so calling eval make it accessible
eval(selectAll);
selectAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment