Friday 12 December 2014

Happy Christmas!

Wow, it hardly seems like two years since Desynit produced our "Merry Christmas" video (which you can find on my Blog Post from 2012 here) but it has been. Since then, we've grown so much as a company we have had to move office. We now have our own meeting room, two front doors and "Mac" users in the company. Things are changing fast.


One thing that hasn't changed though is our creative, and fun brand promotion and marketing initiatives. It seems almost every week these days I'm "borrowed" from my desk to snap a quick picture, proof-read a blog post, or take part in some complicated stunt to help promote a tweet, user group event or any one of the many channels of activity Desynit are involved in.

Luckily, this year, our Christmas message was a little easier than donning the old itchy beard... all I had to do was give away a bottle of craft beer in fact! On the run in to Christmas (the last 12 working days) each of the team here is featuring in a social media post with a piece of seasonal technology advice, as a gift to the community. My top tip was for the best service "remember to shop small and local". I am a big advocate of using local businesses and services, and believe that knowing the people you are dealing with is really important. It's definitely something I advocate here at Desynit, always making sure to phone clients when needed/possible and make sure they are comfortable with their projects, and know the people behind the work - we're not just some factory churning out pages of code.

https://www.facebook.com/Desynit/photos/a.142715185831664.18297.114710818632101/529701483799697/

Anyway, if you are reading this, you are too late to win the bottle of beer - that went to Python developer Tom Blockley, from Team Rubber but you can still have a laugh at a "Elffed" up picture of me on the facebook post here.

So Happy Christmas everyone, I hope you have a prosperous 2015!

Tuesday 23 September 2014

Service Cloud's Support.EmailTemplateSelector Example

A cool feature for Salesforce Service agents is being able to send e-mails back to customers directly from the Case Feed using the "Email" publisher action.

Using things like Auto-response rules and Quick Text allows agents to manage customer queries with incredible power and ease, but one case scenario I found that has come up a number of times is wanting to have almost case specific boiler plate text pre-filled in the e-mail, such as salutations and signatures.

It is definitely not uncommon to have more than one "product" or "channel" being managed through Service Cloud support cases, often by the same group of agents, changing their hats as different cases need attention, and so presenting the most appropriate Email Template for them to "fill in" as a response to a customer comes down to the "Enable Default Email Templates" feature..


This can be found and enabled in Setup > Customise > Cases > Support Settings towards the bottom.. but don't go over then enabling it just yet, as you need to do some ground work first.

Once enabled, this setting lets you use an Apex Class to determine which Email template you will use for this specific case. This literally throws the full power of Apex into the decision engine you are about to craft.

I am going to talk you through using this feature to deliver two different e-mail templates which can be used depending on whether a case was delivered to the system by email-to-case or web-to-case.. and this assumes you have configured these two channels to set the "Origin" of the case to Email and Web. In each case we want to salute the customer, thank them for engaging on the relevant channel and then sign off with a different help desk name. The middle of the e-mail will be left blank for the agent to fill in their response.

So

Step 1. Make the e-mail templates
I won't molly coddle you through this process. Go into Setup > Communication Templates > Email Templates and using your favourite format, folder structure and style, craft two different e-mail templates for your support staff. My Email support one looks like this:



Once you have them...

Step 2. Create your Apex Class
Now this really is the crux of it. You have to provide an Apex Class that implements the Support.EmailTemplateSelector interface, and implements the global method global ID getDefaultEmailTemplateId(ID caseId) in it. This returned ID is the template that will be placed into the Email box when a case is loaded into the Case Feed.

So here is where you can get complicated, there are examples using dozens of templates, custom objects and custom settings to determine what template to load, so go nuts! In this simple example though, I am going to use the Case Origin to load a relatively named template, or return null (which will just use the default email format).

This is all my class contains:

global class DefaultCaseEmailTemplates implements Support.EmailTemplateSelector {
 
    global ID getDefaultEmailTemplateId(ID caseId){
        // Load the relevant case details
        Case thisCase = [SELECT Origin FROM Case WHERE Id=:caseId];
        
        // Concatenate the "matching" support e-mail name
        String templateName = thisCase.Origin.replace(' ', '_') + '_Support';
                
        // Load the template Id by this name
        List emailTemplate = [SELECT id 
                              FROM EmailTemplate 
                              WHERE DeveloperName =  :templateName];
        
        // If we got one, return it, otherwise return null
        if (!emailTemplate.isEmpty()) {
            // return the template Id
            return emailTemplate.get(0).Id;
        } else {
            // returning null means the system just presents a blank response template
            return null;
        }
    }
}

And it is as simple as that for this case scenario. "Web" origin will load a template called "Web_Support" and "Email" Origin will load "Email_Support" - if the user wants to add more channels to the origin, they can do so, and either add a new template (with "_Support" at the end) or just let it fall to the default. Lovely.

Step 3. Test that class
Now, personally, I do test driven development, so this would be step 1.5 technically in this flow, but I have included it after the Apex Class, because I know how to keep an audience interested ;-)

Testing this class isn't too difficult, but there is a trick or two - due to some old friends such as setting up system objects and user records in the same context.  

(One short fall of this test class is that it requires a user in the System Administrator profile to be available... I personally consider that a given though)

Here is the simplest (single pass, positive scenario) test class for this. I suggest you augment this a little for your own implementation if you believe in good testing!

@isTest
public class DefaultCaseEmailTemplatesTest {

    @isTest
    static void LoadEmailTemplates_SuccesfulScenario_ReturnsTemplateId() {
 
        Id templateId;
    
        User thisUser = [SELECT Id FROM User WHERE profile.name ='System Administrator' LIMIT 1];
        System.runAs(thisUser) {
            templateId = insertTemplate();
        }
        
        Id caseId = insertCase();
        
        DefaultCaseEmailTemplates dcet = new DefaultCaseEmailTemplates();

        Id result = dcet.getDefaultEmailTemplateId(caseId);
        
        System.assertEquals(templateId, result);
        
    }

    private static Id insertTemplate() { 
  
        EmailTemplate emailTemplate = new EmailTemplate(DeveloperName='test', Name='test', FolderId=UserInfo.getUserId(), TemplateType='Text');
        insert emailTemplate;
        
        return emailTemplate.Id;
    }

    private static Id insertCase() {
 
        Case testCase = new Case(Origin='Email Just Ingredients');
        insert testCase;
        
        return testCase.Id;    
    }
}


Ahh. I love it when a test class ends up 10 times the length of the code it is testing!

Step 4. Enable this class
Now it is time to head back over to  Setup > Customise > Cases > Support Settings and set "Enable Default Email Templates" at this point it will ask for your class, so point it at it using the lookup box.,

Step 5. Test it out
Head over to your Case page, or Case Feed page, for a case that has one of the Origins you specified, and click to open the Email publisher action (if you don't have this action, you will have to Google how to do that! (hint: it's under Actions on the Page Layout Editor) - and if everything has gone right, you should see you e-mail template loaded into the box, ready to be completed!


If you load a case from a different origin, you will either get their adjusted template, or no template at all. Easy!

Now - go make that Apex Class over-complicated!

Wednesday 13 August 2014

Why you should absolutely let your employees attend Dreamforce

Dreamforce, the Salesforce flagship annual event is slowly getting closer and closer, and no doubt if you employ Salesforce administrators, developers, or anyone who engages the platform on a regular basis, they are probably just itching to be able to attend.

Trouble is, it's a long event, a long way away (from anywhere that is not San Francisco) and not a cheap ticket... so how can you justify sending them?

You could use this "ROI of Dreamforce" calculator and it'll probably tell you your staff will be 28.3% more productive, or profitable, or something.. but if you want to really know why you should let your employees attend Dreamforce, here are a few hints..

They will absorb knowledge, inspiration and enthusiasm from some of the greatest minds on the planet. Entrepreneurs and world leaders, talking to a room of tens of thousands of delegates. They will see demonstrations of products and platform developments they can hear no where else on Earth at that time.

Your staff will high-five strangers mid presentation, and they will come back to work and they will high-five you.
Learning directly from their peers.. there are literally thousands of sessions going on at Dreamforce, the schedule planner is a heartbreaking exercise of realising there is only one of you to go to Dreamforce! You want to be everywhere. If you do choose to send people to Dreamforce, buy them extra notepads. Hell buy them iPads, and they will come back with more knowledge and tricks of the trade than they will get from a dozen "Pop up workshops" in awkward working lunch breaks...
Win a car! Why not. No-one leaves Dreamforce without at least some cool swag. I got some Dre.Beats Headphones last year, for winning a challenge.. a challenge which taught me a world about DocuSign. I have now implemented this in my working life a number of times, and would never have been as capable to if it wasn't for Dreamforce. DocuSign also gave me a hoody, so I even look like a bad-ass professional now too.

You want your staff looking like bad-ass professionals? Of course you do!
Memories. You know that sighing noise some people make at 5:15 when they realise there is still quarter of an hour to go in the day? We don't have that at Desynit, we do things like smiling, fist-bumps and sometimes Shaun does a handstand walk across the office. This is all because we get to share in the awesome experience that is Dreamforce, and every time we tell people about it, they say "Wow, where you work must be really cool"

And I just say "Hell yeah".

Be that boss.

Do not delay, get booked in and en route to Dreamforce today!

Why you should absolutely attend Dreamforce - For you

This is one of a pair of Blog posts, branded "for you" and "for your boss" - this is the "for you" edition.. "For your boss" can be found here:

Why you should absolutely let your employees attend Dreamforce

So why would you want to attend Dreamforce? Well, let me explain it to you with a couple of pictures...

Dreamforce turns downtown San Francisco into a technology playground. Every corner has a Salesforce flag, and almost every hotel can be dropped into to catch a session on Case Management, Community, Development, Certification and so on. You might think you'd get sick of seeing the logo at every turn, but trust me, you actually slowly fall in love with it.

You become literally surrounded in Salesforce knowledge and enthusiasm.

The bits of San Francisco that Dreamforce doesn't turn into a technology playground, it turns into a music festival! Metallica, RHCP, Green Day, Blonde, and this year Bruno Mars all rock out 40ft stages, with free food and drink at the Dreamforce gala, where you will make more friends and connections than any stuffy "Speed Networking" event at your local town hall...

Ever wondered why there is no heavily publicised "VIP" pass for Dreamforce? Everyone is a VIP!!

You will learn like, a thousand new things - and that is not hyperbole! Every corner, every desk, every wall is plastered in screens, books and projectors. If you can carry them, there is a library of workbooks and the latest Fundamentals up for grabs (whilst stocks last) and with three main stages in the Developer Zone, and about 8 break out rooms, there are more sessions and presentations going on that you could see in a month, let alone 4 days.
At my first Dreamforce I didn't leave the Developer Zone all conference!
Make your dreams come true, meet influential people, maybe meet some idiots who  make you feel better about how good you are at what you do(!!) but get on it and have a good time. If you try to attend every session in your schedule you will leave with a notepad full of notes. If you spend more time in the breakouts, you'll meet tonnes of amazing people (get a sweet photo with SaaSy) and STILL leave with a notepad full of notes, contacts and developer friends for life..

Your face will hurt from the smiling by the time you are on the plane home.

Do not delay, get booked in and en route to Dreamforce today!

Thursday 24 July 2014

Adding a picture to a record in Salesforce

The concept of "Profile pictures" is pretty common these days, and default pictures of products or locations are standard fare for most CMS systems and websites. Getting a default picture displayed directly on a Salesforce record can be a little tricky. In this blog post I am going to talk through how I added my own, user manageable contact picture directly on the Contact record page (but you can re-purpose it however you like to other object types).

[Incidentally I am aware of Social-Contact settings, but more often than not this doesn't provide a "suitable" photo of a contact - my facebook picture certainly isn't! - and it only works for Accounts and Contacts of course]

Here is the goal we are after then:


You can see the cool picture associated with the Contact there, and a button to "Upload new photo". Lets walk through the other cool functions of this simple feature, and then I'll tell you how I did it (copy-pastas can just scroll down for the code snippets).

When you first create/arrive at a contact page without a picture, you are presented with this:


Clicking the "Upload photo" button presents this standard form:


Which in turn allows a user to select a local file and "Save" it to the Salesforce record. Now whenever they view the record, they will be presented with this photo, and a button to overwrite this file with a new photo, which takes them via the same form as above.

The process actually taken here is that the form uploads a file to the "Notes and Attachments" of the record, with a specific filename (set in the Controller). The controller is careful to make sure there is only ever one of these files (in the obscure case another file is added manually, the first is retrieved by the page, and next time the profile picture is updated, it will clear out all spurious files)


By doing this, we don't need any new "rich text fields" on our record, or indeed anything more complicated than a Visualforce snippet and Apex Controller extension.

The visualforce page:


<apex:page standardController="Contact" extensions="ContactPhotoUploadController" showHeader="false" standardStyleSheets="true" sidebar="false">

<apex:form id="contentForm">
<div style="height:170px;">
    <apex:pageBlock mode="maindetail">
    
        <apex:pageblocksection columns="1" rendered="{!displaying}">
            <apex:image height="150" value="{!URLFOR($Action.Attachment.Download, currentPicture)}" rendered="{!currentPicture != null}"/>
            <apex:outputPanel rendered="{!currentPicture == null}"><em>No picture currently available</em></apex:outputPanel>
        </apex:pageblocksection>
        
        <apex:pageblocksection columns="1" rendered="{! !displaying}">
            <p>Use the button to below to select a new file and then press "Save"</p>
            <apex:inputFile value="{!profilePicFile}" />
            <p>Or press Cancel to return.</p>
        </apex:pageBlockSection>
        
    </apex:pageBlock>
</div>
    <apex:commandButton value="Upload new photo" action="{!toggle}" rerender="contentForm" rendered="{!displaying && currentPicture!=null}"/>
    <apex:commandButton value="Upload photo" action="{!toggle}" rerender="contentForm" rendered="{!displaying && currentPicture==null}"/>
    <apex:commandButton value="Cancel" action="{!toggle}" rendered="{! !displaying}"/>
    <apex:commandButton value="Save" action="{!saveFile}" rendered="{! !displaying}"/>
</apex:form>
  
</apex:page>

This handles the display (or not) of the picture, form and relevant buttons.. and also sets the height that we will be working with (which is relevant when we come to add this to the page layout in a second).

Here is the controller extension that facilitates the uploading of the file and retrieving it when the page is loaded:
public with sharing class ContactPhotoUploadController {

    Private Static FINAL String fixedFileName = 'profilePhoto.jpg';

    public boolean displaying { get; set; }
    public Contact pageContact;
    public Blob profilePicFile { get; set; }
    public Id currentPicture { get; set; }
    
    /** Constructor, grab record, and check/load an existing photo */
    public ContactPhotoUploadController(ApexPages.StandardController controller) {
        pageContact = (Contact)controller.getRecord();
        
        List<attachment> currentPictures = [SELECT Id FROM Attachment WHERE parentId = :pageContact.Id AND name = :fixedFileName LIMIT 1];
        if(currentPictures.size() != 0) {
            currentPicture = currentPictures.get(0).Id;
        }
        
        displaying = true;
    }

    /** toggle switches between the photo display and photo upload form */
    public void toggle() {
        displaying = !displaying;
    }
    
    /** saveFile clears any existing profile picture, retrieves the data from the form, and saves it under the relevant filename*/
    Public Pagereference saveFile() {

        // first, we cannot have any conflicting files
        List<attachment> savedPicture = [SELECT Id, name, body FROM Attachment WHERE parentId = :pageContact.Id AND name = :fixedFileName];
        if(savedPicture.size() > 0) {
            delete savedPicture;
        }
       
        // Now, we save the new blob
        Attachment a = new Attachment(parentId = pageContact.Id, name = fixedFileName, body = profilePicFile);
        insert a;
        
        currentPicture = a.Id;
        
        displaying = true;
        return null;
    }
    

}

Once you have this basic Visualforce page up and running, all you need to do is go over and configure your Contact (in this case) Page Layout, and add the Visualforce page to the screen, and set it to a height of 30px greater than the style height of the div - this is to fit the buttons in underneath.



Boom, there you go, now users can add and edit a default photo on any kind of record page (you just need to tweak the controller to use the standard controller of another object).

Please note, in this blog post example I have neglected to address any kind of permissions or security considerations.. so remember if you decide to implement this to think about which users should be able to load, or upload photos to records. That's the kind of rich, useful developer love you would get from a Desynit based implementation ;-)

If you have any queries about this, or would like a complete implementation of this brought to your Salesforce org. Please don't hesitate to get in touch with me directly, or give Desynit a call and we can sort you out!

Wednesday 9 July 2014

Salesforce Summer is here!

Summer is almost upon us, and I don't just mean that every now and then the rain stops over here in England, I mean in just a couple of weeks the Salesforce release cycle will turn another notch, and one-by-one, all of our Salesforce instances will be the eager recipient of a whole flurry of new and exciting features. So we get to stare up and down the setup menu for the intreging little "New!" text next to menu items, and then spend a whole afternoon exploring the brilliant things to see and do.


If you want to find out everything there is to know about the coming release, I can recommend you read the Salesforce Summer'14 Release Notes - but seeing as they are 340 pages long, and you might have a busy day lined up ahead of you, let me take you though some of the most interesting bits from my point of view.

Incidentally, the release dates for each org are available on the Salesforce Trust Scheduled Maintenance page and you should be getting the white prompt page forewarning you of your instance update now when you log in.


So, first of all, I think we need to look at the most important aspect of the new release, because it is a feature that will affect many of us every day, many times a day.

It's the new logo.

It's a Snorkel. I Love it!

But moving on.


The key developer changes to my project work in this Salesforce Release are:

Longer text fields - The maximum length of Long and Rich Text fields has been increased from 32,768 to 131,072 characters - they still defaults to the usual length, and existing fields will not be changed. Exciting times for super-verbose users.

More lookups and external IDs  - Salesforce are always happy to deliver bigger limits as soon as the technology and hardware facilitates it, and it seems that with Summer'14 the database layer is able to deliver more capacity for relationships and external IDs (which, of course, means more indexes) so you can now have 40 (instead of 25) relationships and 7 (instead of 3) external IDs.

THREE TIMES THE API CALLS - Sorry, I had to shout that one. At least twice in recent memory, I have seen a developer edition max out it's API calls in 24 hours and seen said developer skulk off to the pub coffee shop because they can no longer work. Especially when the Developer Console was ridiculously API hungry, or someone was running tests from Sublime Text. Well, now they can work three times as long, because Developer Editions now get 15,000 API calls instead of the old 5,000.



Improved Setup search -  lets you directly search for custom objects and fields in the Setup menu search, saving us all that time going through "Create > Objects > ObjectName > Scrollscrollscroll"

Publisher Actions for Chatter Off Organisations - This is a common one for me, we have a lot of clients who are yet to accept the leap to enabling Chatter in their organisation. Before now this meant a lot of Salesforce1 and the incredible power of Publisher Actions was denied to them as well. Not any more! Publisher actions to directly update records straight from the button are now available to those businesses.

Proper find in the Developer Console - At last, a proper find, find next and find/replace tool will be available in the developer console! And even better, real search "across all files" will let you find that snippet of code you can't remember where you put it. They are also releasing the ability to re-format your indentation properly, but as a legitimate developer, I always indent my work correctly first time, every time... (yeahright). You can get to all of this through a new "Edit" menu item appearing soon.

No limit on the Describe methods - Did I mention Salesforce like to smash down their own governor limits? Well, here's another one for the scrap heap. Take a quick look at this search result page on the Salesforce Stack Exchange and you will see that people have been battling with this ceiling for a little while now. So... should we get a SFSE moderator to just delete all these questions now?! :D

Full name functionality - Found that you add a custom field "Middle name" to Contact for every other human-contact-heavy client case? Well, now (via a switch on from Salesforce) this is a standard field for Lead, Contact and Account sObjects (it is also on the Name and User objects).

...and that's just the big stuff...

 In the whole new domain of mobile applications, developers will see awesome new features in both SalesforceA and Salesforce1. I noticed for Spring'14 the Developer Certification now recommends you go through the mobile release training materials too, because the Salesforce1 Mobile App is not just a bolt on, or a piece of configuration, it is it's entirely own development suite now. My user highlight for Salesforce1 this release is Approval processes - Just like with change sets, approval processes are always rocking up to the party a little bit late, but they have finally made it into Salesforce1, users can now submit their records for approval from within the app. A slightly glaring hole plugged beautifully (and quickly).

My developer highlight for Summer'14 Salesforce1 (and I feel I have saved the best for last) is called the Account and Community Switcher - which is a complicated way of saying you can switch between orgs within Salesforce1 without having to log the whole app out. This is especially apt for me, as you can see from this tweet.. "Hmm. I wanna test this new app on @salesforce1... But I simply can't log out of my work org on my phone?? "Logout > Yes" just does nothing?!" I have something of a problem switching orgs on my phone (short of uninstalling the app and reinstalling it).

To swap orgs, you simply open the left hand nav, and at the top there is a picklist which will list all of the other orgs connected to the user currently logged in to the app on the device, and you can just tap another account to jump across. Sandbox heaven!! Thank you Salesforce.


(Of course - 6 months ago I would have been over the moon that Salesforce1 is now properly supported on Blackberry (and Windows) phones, but pfft who still has a Blackberry?!)


Final thought for the day, I wonder what the Southern Hemisphere think of the Salesforce release cycle names then, "Summer?" - "Not here mate!" pretty sure we already have all the Winter'14 features down in Oz..

Wednesday 23 April 2014

Modifying the "New Email on Case" Template in Salesforce

If you are using Email-to-Case on Salesforce, there is a super handy standard feature that will send an e-mail out to the case owner when a new incoming e-mail is filed against one of their cases.

This is an option turned on via Setup > Customize > Cases > Email-to-Case and then checking the box "Notify Case Owners on New Emails.


Then, when an incoming e-mail is detected by your Email-to-Case config and associated with a Case, the owning user will get an e-mail that reads:

An email has been received for case 00003630: Case system test.

Please click the link below to review the new email and respond appropriately.

[https://na13.salesforce.com/02sf00000000000]

NOTE: It is not recommended that you forward this email because its association with the original case may be lost.

and then the body of the email from the customer..

The requirement that led me to end up writing this was to replace the link in the middle of the e-mail for a client, but I can imagine a whole host of reasons this message might want customising in client systems.. but, if you are setting out on that road, like me, you will probably find quite quickly it is not a standard or custom e-mail template that you can edit. It is fixed, and can only be turned on; and off.

So what do you have to do if you want to edit it? You have to turn it off and replicate the functionality.

Turning it off can be done by following the navigation steps above and then de-selecting the checkbox. Now, when a new e-mail enters a case via Email-to-Case, there will be no notification. Now, you need to build a workflow rule to replicate the functionality.

That is not as simple as it sounds though. Here are the steps we will have to go through:

  • Create a workflow rule on Email Message that will be triggered when a new incoming case e-mail is inserted
  • Because Email Message workflows cannot dispatch Email Messages themselves, we will have to do a field update instead, which we perform on the parent Case
  • Add a workflow rule to the Case object to send the owner an e-mail when it is updated by the previous workflow
First we need the field on Case to update; lets make this field a Date field, as it is something we can set with a formula value quite easily and it gives us an audit value that maybe just one day might be useful to someone!

Access your case fields via Setup > Customize > Cases & Fields and click to create a new field. Call the field "Last Emailed" so the API name is Last_Emailed__c and set it's type to "Date/Time"- make it not required and with no default. I would leave field permissions at the defaults, but then remove it from all page layouts (for the moment at least).

Now we have our field, we need to cause it's update, and then effect it's action to dispatch an e-mail. First let's set it, and we are going to do this when a new Email Message is received on a case.

Click through Setup > Create > Workflow & Approvals > Workflow Rules and click to create a new rule.

On the first page, select "Email Message" from the object drop down (this may only be there if Email-to-Case is enabled). Call it something like "Custom Notification Email" and have it fire whenever a record is created. Set your Rule Criteria to be a Formula, and for the formula enter "true" so every message triggers this Workflow.

On the next page of the Workflow, click to add a New Workflow Action and then select New Field Update and populate it as such so that it will update the case field we have just created to the value of the Formula method "NOW()":


Once this is done, and you are presented with the Workflow, here is a catchy step. Click to Edit the field update you have just created, select the check box to "Re-evaluate Workflow Rules afer Field Change" and save it.

Edit: July 2015

Thank you readers for your comments that this stage is no longer possible! I recreated the steps and lo-and-behold, you cannot mark this field update to re-evaluate. How weird.
 
Therefore, we need to find an alternative way to send the e-mail based on this first workflow evaluating. Well seeing as it's now 2015, why not use Process Builder! Process Builder comes later in the order of execution than Workflow, so I can't see why you couldn't create a process based on the same conditions/premise as this post - that sent an e-mail when the Case "Last_Emailed__c" field was updated.

I don't have time right now to test this sorry :( but if anyone has any luck with that route, please let me know in the comments. Just replace the word "Workflow" with "Process builder" for the rest of this article, and the complicated screen shots for the lovely new screenshots that a Process might have!

Resume original post:

Finally, complete the Workflow setup and remember to activate it! This is the most commonly made workflow mistake is forgetting to activate! We now have the second stage of our process complete.

Before we can make our final Workflow rule to dispatch a custom e-mail, we better make sure we have our custom e-mail template ready to use. Click through Setup > Communication Templates > Email Templates and make a new template (the details of the process for which I will not cover here as it is well documented).

Now we can make that final Workflow rule. Go back to Setup > Create > Workflow & Approvals > Workflow Rules and click to create another new rule. This time, we are making it on "Case".

Give you rule a name, and select "created, and every time it's edited" as your evaluation criteria. This time, the rule criteria is important, as we don't want to send an e-mail everytime any change is made to a case, therefore, select the formula criteria entry again, and this time enter

ISCHANGED(Last_Emailed__c)


This means the Workflow will only fire if the "Last_Emailed__c" field has changed from it's previous value (i.e. the first workflow rule caused it).

Once we have this, get into your new Workflow rule, add an Email alert, choose your custom template (this is the point you might want to set off your success fireworks) and pick the "Owner" as the recipient. Fiddle with any other settings you like, then save your Workflow, activate it, and sit back and watch as new incoming e-mails cause the dispatch of a custom notification email to the case owner to inform them of this message.



Monday 24 March 2014

Packt Publishing - BOGOF on 2000 IT books!


 Recently you may have seen recently I was reviewing the Visualforce Developers Guide by W.A. Chamil Madusanka (full blog post is still in draft!), published by PACKT Publishing, who in their own words are "one of the most prolific and fast-growing tech book publishers in the world".

Along with the Developers Guide, my colleague Christopher Alun Lewis has reviewed Kier Bowdens Visualforce Development Cookbook - which I am also now reading and is another fantastic publication keeping us all up to date with the best Salesforce design patterns and practises.

Having been through these two great publications, I am now always on the look out for the next PACKT title, and it has come to my attention, that for TWO MORE DAYS ONLY!! (that is until March 26th 2014) in celebration of reaching 2000 published titles PACKT are offering a "Buy one Get one Free" across their entire range of eBooks. That means there a literally hundreds of fantastic software titles just waiting to get swept up on every aspect of Software Engineering. You could honestly get the two books mentioned above for the price of one (but I'd recommend browsing their full range before decided what to get!).

If you follow this link through to PACKT publishing, you can buy as many eBooks as you like, and when you get to the checkout, you will immediately notice you are only paying for half of them!


Don't waste any time on this one, as there isn't much time left. Have a word with your line manager about getting some technical reference material in and go crazy. You're never too old to learn how to do your job better, and to know a little more!

I would like to make it clear that by participating in this BOGOF campaign promotion, PACKT Publishing are furnishing me with a free book from their library.

Tuesday 11 February 2014

Getting stacked with Salesforce!

For the last two years (thanks to a successful Area51 Beta) Salesforce has had it's own branch of the Stack Overflow product, in which users can ask, answer, discuss and vote on Salesforce issues, problems and features they are working on. This is the Salesforce (beta) StackExchange.

Over the last two years, this product has exploded in the Salesforce developer domain, with (at the time of writing, in February 2014) statistics in the region of:


8,729questions
12,841answers
90%answered
4,330users
11,338visitors/day





With useage, and success rates like that, it's easy to see why the StackExchange is becoming the go to place for Salesforce questions, with answers typically being provided in a matter of minutes, to some of the most complicated questions.

With thousands of users, from every timezone in the world logging in every minute of the day, it is clear to see why and how if you have a query about Salesforce, there is going to be someone out there who has experienced this before, or has the knowledge to guide you through to a solution.

But is that the real reason the StackExchange is so popular? Of course not, it's all about badges and reputation of course!! One of the most addictive types of gamification in the modern arena is earning reputation from your peers for assisting them, and by providing the best service over your peers!


The model has completely hooked me. I even find myself logging on from my smartphone during bus rides to see if there is a question I can help out with! The buzz of finding someone you can assist is matched only by the excitement in your hands as you rattle out an answer at a typing speed that would make the Clerk of the Houses of Parliament blush.

The other great aspect of the reputation model, is the philanthropy,  as well as enjoying earning it by assisting your community, you have the power to award it as well, if you see an answer that you wholeheartidly agree with, you can vote it up, making it clear to the community that this is a quality answer, and also awarding the user reputation in the process.

Good questions, equally, can be voted up if you think them especially pertinent, and even the smallest aspect - comments - can be flagged as useful or helpful making sure everyone knows which snippets of text are good or bad.

Some of the questions that I have asked and answered include:

Getting the value of an inputField on the page

Which has been viewed over 3,500 times.


Friday 10 January 2014

Getting your Certified Force.com Certification

On January 8th I had the pleasure of presenting a case at the South West UK Salesforce Developer meetup, which is an event that happens every other month in Bristol UK, where the regions Salesforce developers, CTOs, and Force.com-curious meet up for a couple of pints, some short talks, and a lot of technical debate about living on the Force.com Platform.

The theme of our January meetup was "Certification" - which we thought was appropriate, what with this being the time for resolutions and making plans. I co-presented the first talk which was an introduction to certification process through the Certified Force.com Developer option. The second presentation was by Christopher Alun Lewis on his experience of the Advanced Force.com Developer.

Here are my slides from the talk, which I was asked to share by some of the audience, and below them a quick script covering what I spoke about on each, to support the otherwise vague bullet points!


Slide 1: On this deck, this is an into slide.

Slide 2: Welcome to the South West DUG presentation on becoming a Certified Force.com Developer, I myself have been certified for about 18 months now, and Julio, who will be telling us all about his experience with certification, has been qualified himself for 6 months.

Slide 3: What is the Certified Force.com Developer qualification then? It's a badge, that you can quite literally wear (see slide 4) to indicate that you are a competent Force.com developer, familiar with the platform and it's features and functions. If you want to pitch yourself to clients and employers as a Salesforce developer, it really should be seen as the minimum entry criteria. It is an exam based qualification, which is taken in an invigilated enviroment, and consists of 60 multiple choice questions about developing on the Force.com Platform, of which you must get 41 right. You have 90 minutes to do so, and once you have submitted your answers, the examination software instantly tells you if you have Passed or Failed.

Slide 4: An example of putting the badge into place!

Slide 5: So how do you go about getting certified down in the South west of England? Our test centre is in Bath, by the river, about 10-15 minute walk from the train station, so it's really not hard to get to.  A bigger consideration is perhaps that it does cost $200 USD to take the exam and you do need to book in advance (normally a week or two at least) on the certification website. Once you have the qualification, you should also note that it has to be kept up to date, and this is done via 3 annual maintenance exams. These are done on your home PC in your own time (within a 5-6 month window) and involve answering 6 more multiple choice questions on the latest features, or platform core concepts, to show you are still a valid, involved developer. The first year comes free with your qualification, but after that you must pay $100pa to keep the certification valid.

Slide 6: What is it they are looking for then when you walk through that examination door? The Certified Force.com Developer is not about code, or syntax, or APIs or Libraries. It's about understanding the Force.com platform, and knowing WHEN to code and WHEN to click. You need to show a good understanding of configuration driven solutions, or when you would be forced to code. You do not need to know the code you would use though. The second part of this slide is taken from certification.salesforce.com verbatim, and breaks down the core concepts the exam will cover. Be familiar with ALL of these areas, you cannot pass by being a total expert in some, and know nothing of others.

Slide 7: The tools of the trade then, how do you go about actually passing the exam? Your first choice would of course be the course. Salesforce 401 covers the exact requirements for the Certified Force.com Developer qualification. But in the UK you would probably be looking at taking part in a 5 day, virtual classroom experience for the best part of £3,000... if you got the time and the money, I guess go for it, but failing that, the fundamentals book, and a bit of hands on experience with the Platform will serve you just as well. All the Certified Force.com Developers I know have self-taught/learnt on the job. I do know some of the qualified trainers on the 401 track through, and they are bloody nice people :)

Slide 8: This is Julio's story, .. another great read on the Certified Force.com Developer road.

Slide 9: So this is my story, now you know the facts of life. I had been working on the platform for about a year when the time came for me to get the certification. I came from being a Java developer, with 6 years commercial experience and a Computer Science degree, so I felt ready for a new examination challenge. I would say one of the biggest benefits for me was working alongside an existing Certified Force.com Developer, so any time I had a question both about the platform or the certification process, I could ask him, and he could put my mind at ease about the logistics and process of the exam. I booked my exam in with about 2 months notice, to let me gear up for it, and the last thing I did, was take 2 weeks out (of life) and just ploughed through the entire fundamentals book, doing the exercises and extensions, to remind myself of the core concepts, and all the bits (like reports and, security) that we don't really think about properly during our day to day work. On the day, I took about 75 of the 90 minutes to answer, review and submit my winning score to the system, I chose not to beat myself up for the full time period, because I would only end up over thinking choices and changing right answers.

Slide 10: So, any questions? If not... here's one for you..

Slide 11: This is the actual example question off the certification.salesforce.com website for Certified Force.com Developers. Can you answer it? I'm not going to tell you the right answer, but chuck me a comment in the section below with your thoughts!

Well. Thanks for reading through that journey with me! If you'd like to know more, please get in touch and I will field your questions, you can also tweet me on @srlawr if you like. If you live in the south west UK, get in touch with your local Salesforce Developer User Group for free beer and chats like these.