JS to quickly check Salesforce field-level visibility checkboxes

Posted on Jul 07, 2015

This is a small, handy little javascript that will check all the checkboxes on the Field Visibility screen for a user profile.  Should work in the javascript console of all modern browsers.

var x = document.querySelectorAll(".displayedCol input"); for (var i = 0; i < x.length; i++) { x[i].checked="checked"; }

Sometimes while setting up objects and profiles for a project, you might do things out of order, or create objects using the Schema Builder or the Meta API, neither of which lets you set field permissions for user profiles.  Then you find yourself needing to go to each user profile, go to the field-level visibility settings of each object you created, and check all those boxes so the fields will be visible to the new profile.  The above javascript will check all the boxes for you; it's basically a "select all" for the Visibility column.

On using hash tags in your code comments

Posted on Jun 09, 2015

I write a lot of code comments. It helps me structure my code and make it a bit easier to scan, but it helps my future self too: understand why I did something; alerts for pitfalls or not so obvious code structures; etc.  I've also written apologies to other developers who may come across my code one day. :P

Something that I've started doing in the past year is "tagging" my code: adding hashtags to act as bookmarks to help me find key lines of code that are related to something I'm working on or something I did in the past.

Some examples:

// #tags #kludge #revisit

...or...

// #tags #2015rebuild #govLimits

They always start with "#tags" so I can find all the tags later (doing a search inside project files) and remind myself of what keywords I used, and then follow up with something more descriptive about whatever I'm tagging.

Javascript access to Media Queries & Link dump: Connection latency, the fate of client services and more

Posted on Feb 18, 2015

Since the new year I've been doing some research about what's being going on in the front-end dev world in the last few years since I've been away from it.  The times, they are a changing, and they are a changing rapidly!  I've pulled together a link dump of a bunch of articles that I found really interesting on a range of topics, you may find some of this useful and insightful...

On clickjacking

Posted on Mar 06, 2013

I recently had to do some research for a collegue who had some questions about "clickjacking", the practice of hosting a website inside a hidden or transparent iframe (the target), positioning that frame over top of another inocuous, innocent looking page (the attacker) that has a call to action.  The user clicks what they think is something simple (like a video play button) but instead they're clicking on a page element inside the transparent iframe, initiating some action on the target website.

For example, an attacking website could get a user to login to their banking website without them knowing, depending on whether the user had configured their browser to autofill in their username and password on the site.  The attacking site could go on to do lots of other things, tricking the user into transfering money or whatever.

Scary stuff.