Many Pies

Many Pies

Tuesday, June 26, 2018

Morriss' law(s)

I recently came across a couple of lists of software development laws:
The eponymous laws of software development
Laws of software development

I may or may not have publicly stated Morriss' law:
Every site/program/app attempts to expand until it resembles Twitter
See Facebook, Skype, Confluence

However on one of those lists I cam across:

Zawinski’s Law

This law addresses software bloat and states…
Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.


I was going to state Morriss' second law, which is like the first one, but has "until it has Stories", but I think there's Morriss' greater law at work here, which is something like:

If they copy you, you're doing something right.
 There's probably a better way of saying it though.

Friday, April 20, 2018

Free Salesforce postcode checker

While you can get Salesforce apps that check postcodes for you, here's a bit of Javascript that will check a UK postcode for you using the postcodes.io API and tell you if it's valid or not. It's not clever enough to suggest what the postcode might be, but then it is free.

Create a new button on the Contact object (Display Type: Detail Page Button, Behaviour: Execute JavaScript) and put this javascript on it:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
var postcode = '{!Contact.MailingPostalCode}'; 
if (postcode != '') { 
postcode = postcode.replace(' ','%20'); 
sforce.connection.remoteFunction({ 
url : 'http://api.postcodes.io/postcodes/'+postcode+'/validate', 
async : true, 
cache : false, 
method: "GET", 
onSuccess : function(response) { 
if (response.slice(-5) == 'true}') { 
alert('OK'); 
} else { 
alert('Wrong - check using https://www.royalmail.com/find-a-postcode'); 
} 
}, 
onFailure : function(response) { alert('ERROR: '+response); } 
}); 
}
For the Account object use
{!Account.BillingPostalCode}

or
{!Account.ShippingPostalCode}
as appropriate.