MK Partners Tips

AppExchange and other Salesforce Link Tips

Have you ever been sent a link to an AppExchange package and just couldn’t get it installed? Well, sometimes, you need to do a little URL hacking to get things to work.

For instance, here is the installation link for our Web-to-Case Asst product:

https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04tA0000000DiMP

Pretty messy,isn’t it. And when you use it you’ll have to login to Salesforce even though you may already be logged in. This can be fixed though. There are several tools on the web that can decode this URL to look more like this:

https://login.salesforce.com/?startURL=/packaging/installPackage.apexp?p0=04tA0000000DiMP

This is starting to look better, but the above URL wont work on Sandbox and still requires you to login. Watch what happens when we split the URL after “startURL=”:

https://login.salesforce.com/?startURL=

/packaging/installPackage.apexp?p0=04tA0000000DiMP

The first part doesn’t look that useful, but the second part is very useful. It’s a relative URL for any salesforce org. This means you can just paste this second part after your Salesforce server URL and instantly go to the right page without any login required. For example:

If you’re on na1 then, to install Web-to-Case Asst in your production org, you would use the following URL:

https://na1.salesforce.com/packaging/installPackage.apexp?p0=04tA0000000DiMP

If you’re on cs3 then, to install Web-to-Case Asst in your production org, you would use the following URL:

https://cs3.salesforce.com/packaging/installPackage.apexp?p0=04tA0000000DiMP

All you have to do is replace the server subdomain with your specific one and voila, instant satisfaction! So stop struggling and start URL hacking, it’ll save you time and you might learn something.

10% rebate for Vertical Response with Mastercard

If you have a business credit card from Mastercard then you should enroll in their Easy Savings program. There’s no fee to join and no obligations once you do. The program is very simple. If you use your card at specific vendors, then you get a percentage of your purchase back in the form of a rebate on your statement.

Vertical Response, the longtime salesforce.com email marketing partner, just joined the list of participating vendors. So if you’re already one of their customers be sure to enroll in the program and then pay the bill with a business Mastercard to get a 10% rebate on your Mastercard statement.

1 minute or less of reading this blog just saved you 10% on your email marketing costs. Beat that Geico!

New Spring ’10 feature: SOQL Aggregate Functions

Our partner Arrowpointe has a great post about one of the new features in the Spring ’10 release, Aggregate functions.

The Salesforce Object Query Language (SOQL) is familiar to anyone with SQL experience, however, it has always lacked some more advanced functions. This gap along with some of the Apex governor limits can sometimes make it very difficult to slice and dice data to meet your needs. The new Aggregate functions are a huge improvement to SOQL and returns grouped query results so you don’t have to loop through them in your code.

Check out more details at www.arrowpointe.com

Tips for better user adoption

Glenn Elliot at Myriad Minds posted a great short list of four tips to improve user adoption in salesforce.com.

Check it out at their website: www.myriadminds.com.au

What are your tips for improving user adoption? Let us know in the comments.

Lifehacker: Five Wishes for Better Webapps

If you’re not already addicted to Lifehacker, make it your new year’s resolution. The site is a must subscribe for anyone interested in being efficient regardless of where in your life or work you want to be efficient.

Kevin Purdy had a great post the other day about his five wishes for better webapps. I especially liked the part about walled gardens and how the ideal web apps let you get all your data out quickly and for free. For years, salesforce.com has offered free (weekly) data exports to its Enterprise and Unlimited Edition customers and a one-time free export to all other customers.

Speaking of data exports, that’s another great new year’s resolution. Schedule salesforce.com to export your data once a week, not only will it provide you with peace of mind, but it’ll make it possible to restore data if you ever accidentally overwrite or delete something.

8 Reasons to get excited about Dreamforce

Salesforce.com has published their 8 reasons to get excited about Dreamforce on the official salesforce blog

#8 – Pre-conference training and hands-on sessions (Thursday, Nov. 5)
#7 – Salesforce.com Campground (Friday, Nov. 6)
#6 – Force.com Zone (today’s post)
#5 – Cloud Expo (Tuesday, Nov. 10)
#4 – Breakout sessions (Wednesday, Nov. 11)
#3 – Networking opportunities (Thursday, Nov. 12)
#2 – Healthy planet, healthy people (Friday, Nov. 13)
#1 – Keynotes (Monday, Nov. 15)

Check it out

Validating email addresses in Apex

Warning!!! This post is for the Uber-Apex Programmer and should not be attempted by novices. It may cause headaches, hair-loss, eye-strain and more, but it’s well worth it!

On two different occasions in the last week a client has needed email addresses in salesforce.com validated. The only true form of validation for an email address is to send an email and see if it bounces. This post doesn’t cover that. Instead, we’re focusing on the formatting of the email address.

According to a salesforce.com solution (login required), as of the Winter ’08 release, salesforce.com validates email addresses as follows:
1. For the local part of the email address we accept the following characters. (The local part is anything before the @ sign.)
abcdefg.hijklmnopqrstuvwxyz!#$%&’*/=?^_+-`{|}~0123456789
Note: The character dot “.” is supported; provided that it is not the first or last character in the local-part
2. For the domain part of the email address we accept. The domain part is anything after the @ in an email address:
0-9 and A-Z and a-z and dash “-“
3. Example email address:
abcdefg.hijklmnopqrstuvwxyz!#$%&’*/=?^_+-`{|}~0123456789@acme-inc.com

Our goal was to perform the same validation via Apex prior to saving the record. This can be done using a lot of String methods and If statements, but really this type of comparison is best done with a Regular Expession.

Apex already has built-in Pattern and Matcher Classes for this purpose, so all we had to do was come up with the right regular expression. Thanks to some tips at www.regular-expressions.info it was actually an easy task to complete. It was so easy, that we’re releasing this code into the wild for all of our customers (and competitors) to use.

String pat = '[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\*\\/\\=\\?\\^\\_\\+\\-\\`\\{\\|\\}\\~\'._%+-]+@[a-zA-Z0-9\\-.-]+\\.[a-zA-Z]+';
Boolean test = Pattern.matches(pat, email);

Useful Tool: Force.com Debug Log Parser

Kyle Peterson just released a great new Debug Log Parser that all salesforce developers can benefit from. It’s a stand-alone tool that enables you to paste a salesforce.com debug log and then view the various triggers, workflow, etc in a simple to view format. Check it out here.

Way to go Kyle, a lot of people will be buying you a drink at this year’s Dreamforce!.

Deriving Website from Email Addresses

Ever look at a lead record and want to know more about it.  Your first instinct might be to visit the Lead’s website.  Don’t you hate it when the website field is blank but the email isn’t.  You have to copy the domain from the email address and then paste it into your browser.  That’s a minimum of 4 clicks and keystrokes.  What a waste of time!

Wouldn’t it be great, if you could automatically populate the website field based on email address? This solution is so simple that you’re going to hit yourself for not implementing it sooner.

1. Create a new Workflow Rule on Leads with the following filters:
Email contains @
Website equals [leaving the value blank]

2. Add a Workflow Field Update that updates the Website field with this formula:
“www.”& RIGHT(Email, LEN(Email)- FIND(“@”, Email ) )

3. Activate and enjoy!

You can also use this same formula to create a Custom Link for this purpose. You can also optionally filter out common domains like gmail if you want to.

Properly Formatting Names in Apex

Apex has a String method to change all characters to lower case String.toLowerCase and a method to change all characters to upper case String.toUpperCase, but it doesn’t have a method to properly capitalize just the first letter of a name. This can be extremely frustrating when getting data from 3rd party sources that don’t handle it for you. Advanced coders can solve this with a regular expression but for the rest of us, we can use our existing tools like so:

	public static String proper(String s)
	{
		String result = '';
		if (s != null)
		{
			List<String> words = s.split(' ');
			for (String w : words)
			{
				String letter1 = w.substring(0,1).toUpperCase();
				result += letter1;
				if (w.length() > 1)
				{
					String letterx = w.substring(1,w.length()).toLowerCase();
					result += letterx;
				}
				result += ' ';
			}
			result.substring(0,result.length()-1);
		}
		return result;
	}