Friday, February 10, 2012

Area 51 Second Stage: A Call To Arms


Update 14/02/2012:
Thank you everybody! We've hit the commit phase! Time for a quick pat on the back, and then we hit the real challenge  — getting the required 100% score. To do this we'll need a few (read: 100) people with some decent reputation on the network, as well as 200 people committed in total, so please commit and check out some of the other sites on the network (see below).



Update 12/02/2012:
I'm not entirely sure where I read that the commit phase requires 300 people to commit to a proposal for it to reach beta, but it appears that the information below is incorrect — it's going to be even harder to reach beta (but achievable nonetheless). Moving out of the commit stage requires a combination of both numbers of users, and users with decent reputation across the Stack Exchange network. This second part is likely to prove to be the tricky part, as only developers are likely to have that reputation at this stage (though some followers have done a good job of earning some rep on Area 51 already). That said, if you're following the proposal you may want to check out the list of sites on the network to see what may appeal to you, there are sites ranging from Bicycles to Parenting, stopping at Philosophy and History along the way. As of the time of this update, we only need one more question to be voted up to a score of 10 to reach the commit phase!


Thanks to wide support so far, my Stack Exchange proposal for a Salesforce site has reached the required number of followers (the image displayed below is generated by Stack Exchange is not always up to date) to progress to the next stage, it requires just 5 more of the sample questions to be up-voted to a score of 10 or more; if you're following the proposal, please vote on some of those questions if you haven't already. I'm stoked that we've made it this far, but the real challenge will be the Commit phase.

So what is the Commit phase? Essentially it's a phase where no less than 300 people must commit to the site, essentially signing their name against the proposal to say that they will use the site if it enters the final proposal phase which is a live beta site. You can read all about the proposal life cycle in the Area 51 FAQ page. The relevant part is:

Commit! When a proposal enters the "Commitment" phase, we will present a petition for the site's creation. Interested users are asked to digitally "sign" the proposal with their full name to help assure that site will have an active community in those critical early days. While your full name is never shown, you may add an optional comment which is displayed alongside your username in the list of committers. To ensure that commitment is taken seriously, you may only commit to three sites at any one time. 

I'm am under no false impression with regards to how difficult it may be to reach the magic 300, so I ask for everybody's support here, spread the link far and wide (which I'll put here as soon as we reach commit) and encourage your administrators and developers to join in — once this thing hits beta it will be fully functional, and then the true benefits will become readily apparent.

While asking for support for this proposal, I've fielded a lot of questions about why we need yet another another Q&A site, and my argument always boils down to catering for questions which don't fit Stack Overflow, and that Stack Exchange's Q&A format and community-powered moderation is truly second-to-none. With powerful and carefully constructed tiers of community moderation, and gamificaton through the earning of badges, it really shines bright, and it's working so well that even Jeff Atwood knows he can step aside from it with no ill effect

For me, the real proof that the Stack Exchange model works is that Stack Overflow has pretty much become the default place to go for development problems: it has an Alexa rank of 105 globally which is not something to take lightly. So everybody, please, join the push and let's get this site active together so that the whole Salesforce/force.com community can see, and take advantage of, the benefits and power of this finely crafted model.

Thursday, February 2, 2012

StartAllOfTheThings(); - How to Solve a Deployment Headache


One of my biggest bugbears when deploying Apex code to another org, is when you have a schedulable (yes, that is a word in the world of force.com development!) Apex class scheduled and it uses methods in a class that you're trying to update — many developers will have come across this, it stops you from deploying until you've cancelled the scheduled job. This isn't the tedious part though, that part is starting the jobs up again, you need to schedule each one, remembering the correct settings and making sure you don't forget any (or indeed, schedule any twice which is something I've done before now).

I understand why you shouldn't be able to replace code used by a scheduled job, and why even if you don't change the code it uses that if a class needs to be recompiled it's going to have a cascading effect, most likely requiring recompilation of the scheduled class (though I don't know about the specifics of the platform in that area, it would appear to involve something like static linking). This doesn't mean it's not irksome though, especially on orgs where you have many scheduled jobs running and you just need to deploy a minor change.


Any easy way to resolve this is to use code to schedule your jobs, so although you still have to stop them, starting them again is a one-liner in the System Log window, where you run a static method which sets everything up:

MyJobStarter.StartAllOfTheThings();

The class is very simple:

public with sharing class MyJobStarter
{
  public static void StartAllOfTheThings()
  {
    try
    {
      System.schedule('MyJob1', '0 59 0-23 * * ?',
            new SomeSchedulableClass());
      System.schedule('MyJob2', '0 0 8 ? * 1,2,3,4,5,6,7',
            new SomeSchedulableClass());
    }
    catch (Exception e)
    {
      //  Do something here if needed
    }
  }
}

As you can see, System.Schedule uses a cron-like syntax to specify the schedule for the job you're starting and you can find everything you need in the documentation, but for the two jobs in the example MyJob1 runs on the 59th minute of every hour, and MyJob2 runs at 8am every day. I'm aware of others who have taken this further, and created VisualForce pages to fulfil their needs with regards to starting and stopping jobs, but so far for me this has proved to be a nice, simple solution — I still have to stop the jobs, but that was never the tedious part and now I can start them up with a single line of code in the System Log.

Update
As highlighted by @andymahood__c, something I neglected to mention here is another benefit of the System.Schedule method: it can be used to schedule jobs to run more frequently than the UI options allow, up to a maximum frequency (I believe) of every 15 minutes.

Tuesday, January 17, 2012

Three Oh One: Advanced Administrator Thoughts

Last Friday afternoon I undertook the Salesforce Advanced Administrator Certification exam (a.k.a. the 301) — I was reasonably comfortable going in, though did wonder what boundaries of my knowledge it would push. Having done other exams in the last two months, I'm very much in the mind set required and that's a definite help, this exam took me the least time of all those I've tackled so far.

Advanced Administrator builds on top of the Certified Administrator exam, testing in finer detail your knowledge of things like platform security, and how features related to that work, for example the Role Hierarchy. What surprised me about this exam was that involved a reasonable number of questions regarding the force.com platform, for instance, what components may or not belong to the platform and what Visualforce does and doesn't offer. Clearly the thinking here is that an Administrator should know what development-heavy customisations to the platform involve and impact, even if they can not create and maintain those customisations themselves, but it surprised me mainly because there seemed to be more questions on such topics in this exam than there were in the Certified Developer (401) exam.

It's hard to offer any other advice other then the comments I've made, you simply need to know the areas outlined in the study guide. One thing I do in the exam (which doesn't help you pass but does let you get some idea of how you may have done) is to use the scratch paper to create 3 columns, one labelled with a tick, one with "?" and the last with "??!". I then write down a tally mark for each question, the first column are those I know I've got right (or I'm at least  99% sure and would be surprised if I had wrong), the second those I'm pretty sure I've got right but I'm not entirely confident, and then the last column is for those where I genuinely have no idea (luckily these are rare, I think I had 2 in this exam). For all the questions in the latter two columns, I check the box saying "mark for review" and those are the ones I pay special attention to on my second pass through. This time, just before I hit submit I worked out that 72% of the questions were in my first column, and I think 24% were in the second so unless I was wildly out (and I'm pretty strict with myself!) I stood a good chance of passing. Like I said, this doesn't increase your chances, but does give you a rough idea of how well you might have done.

Remember, always read the questions carefully (there sometimes something in the question which will tell you the correct answer), and think about what answer may entail before reading the options presented: there's nearly always something designed to make you second guess yourself and it pays to have already considered what the correct answer(s) will be.

Lastly, too all of those taking the exams, good luck!

Friday, January 6, 2012

Salesforce Stack Exchange Proposal

I've just created a proposal over at area51.stackexchange.com to create a Salesforce stack exchange site, targetted at both developers and administrators who work with the force.com platform. I also started a discussion to explain my reasoning, which I'm including here too to help get some more exposure for it.

Salesforce, and Force.com in general, are attracting increasing numbers of users all the time, and therefore more and more administrators and developers are cutting their teeth on the platform, adding to the numbers who have been using it for many years already. 

Due to the nature of the platform, development can range from configuration (declarative development) which requires no code to be written, through to custom web services, pages, object-oriented code and database triggers. Nearly all complex solutions require a mixture of the two styles, and even working out where the line between can be part of the challenge. Because of the two distinct areas of development I believe a salesforce exchange site would be beneficial for many people because the questions don't really fit in at stackoverflow.com every time.

For instance, today I answered this question:


This could relate to code, but if the requirement is just that a report is needed then no code is needed, making it a bad fit for the site but not leaving the asker anywhere sensible to turn. Personally I find the stack exchange format easier to deal with than regular forums, they're cleaner, neater and generally make it much easier to find the information you need. Ryan Huff (who already responded on Twitter) agrees:

cirruscg: @LaceySnr I like it. I like the stack format better than the dev forums. #salesforce #askforce

So please lend a little support, and let's see if we can get this thing live!


Stack Exchange Q&A site proposal: Salesforce

Thursday, January 5, 2012

Some Of My Thoughts For The New Year: Some Warm Fuzzies

Yesterday I had the pleasure of meeting @bachovski over lunch, and naturally, both of us being force.com developers, our discussions revolved heavily around the platform; what particularly intrigued me was that our opinions of the platform, and developing for it, were very similar.

My programming adventures started when I was around 5 years old, writing procedures in Atari LOGO on my father's Atari 800 and I was instantly hooked. My dad was a programmer for a considerable part of his career (in the mystical era of punch cards which still holds a particular fascination for me) and he then started teaching me to use BASIC on the Atari 1024 STE*. From there it was a natural progression through QBASIC, VisualBasic and onwards. Shortly prior to attending university I began to teach myself C++, and while there I continued this along side the JAVA lectures that formed part of our syllabus. Once I started working in the real world™ I found myself using C, and today I'll still tell you that it's my favourite language - I particularly enjoy the simultaneous simplicity and power it offers the developer (as well as the ease which with you can shoot yourself in the foot of course).

If you ask me these days what my favourite platform is, then the simple answer is that it is force.com. Developing in the cloud is worlds apart from developing for small handheld devices, it still amuses me to think of the difference between the two areas I've worked (and do) work in. When I initially started working on the platform it was as a contractor, and specifically I wanted to be on a contract because I wasn't sure of what I wanted to do, but over two years down the line I'm still here and enjoying it more than ever. It may sound surprising (coming from a developer at least) but it's actually refreshing to be able to do a good proportion of work without a single line of code. Not having to worry about servers, database setup or even maintenance are just the icing (frosting for some of you!) on the cake, and we're talking about some thick icing here. Being a true cloud platform means the speed of development is unrivalled, you can spin up a new developer edition org in a matter of seconds and have a prototype cut in no time — and this is one of the many things Boris and I discussed. Once you've learned the specifics regarding apex and Visualforce (and that's not hard) then it all just flows naturally, and it all just works.

The current focus on the social enterprise is a breath of fresh air, and although he has his detractors, Marc Benioff is likely the leading visionary in the tech industry at this time; Salesforce is forging a path in a new direction, and the frontier is advanced with each new release which makes for a very exciting ride. Sure, it probably sounds like I've drunk the kool aid, but I'm genuinely enjoying what I do and the technology I work with (with the possible exception of using Eclipse, because as far as I'm concerned JAVA is not  the right choice for any desktop application).

2012 is shaping up to be a very interesting year in many respects from my point of view: Haiku is marching ever onwards and can only benefit from the shift to the SaaS model, The Raspberry Pi looks promising as a means of bringing computer science back into the class room (I can't wait to get a couple of boards), and the power of the community is getting ever stronger thanks to sites such as stackoverflow and its sisters. Particularly close to my heart is the local games development community, the Australian talent has endured some heavy blows in recent years but they're fighting back with vigour. Highly-skilled, independent studios are springing up left, right and centre alongside some of the more established companies, and with both IGDAM and the GDAA watching out for them I hope they all enjoy a prosperous and successful year.

*I still hold a strong fondness for Atari (the original company) and those two machines in particular; they're both fully functional and I still love to get lost in Star Raiders on the rare occasions I am at my parent's house. If you've never played it, you should.

Tuesday, January 3, 2012

Where'd My Value Go? Or: What the.....

I've just spent a few hours baffled, before the holiday break I could create events against a particular person account (setting the Related To field) without issue; today, every time I saved the event the field would end up blank. Yes there are triggers on event, but no, they were not the cause — I checked this by putting some debug statements in the first line of the trigger, when using this particular record as the target then WhatId (the API name for the field) would be null.

Having checked everything I could think of (I'd even gone as far as to check the Setup Audit Trail but to no avail), I called my colleague, explained what was happening and he also drew a blank. While on the phone it dawned on me that I was using the suggested item from the recently used drop down list to populate the field, shown in the screen shot below.

The Recently Used Items Drop Down

On an impulse I decided to use that to auto-complete the name, but then clicked on our friend the magnifying glass to open the lookup window proper, and selected the matched account presented there. This time when I saved the record, it saved correctly! Thinking this might have updated some cache somewhere I subsequently tried to the drop down again, but still it failed me.

I've not dug through the javascript to see how the auto-populate works, but at least for the div you click on (the blue highlighted box in the screenshot) there is no difference for a working entry as opposed to a non-working entry. Sounds like a job for the Salesforce Investigation Squad™*.

Conclusion: if choosing something from a drop down recently used items list doesn't work, try using the actual lookup, though I suspect this could easily be related to the fact that this field is somewhat special in that it can lookup to objects of different types. It's the first time I've ever come across this problem, and it wouldn't surprise me if it was also the last, but if this helps anybody then it was worth me writing it up.

* I might have just made this team up, but it has a nice ring to it.

Coping With Demand: 501 Certification Assignment Registration Update

Quick post to share the good news. As many people will undoubtedly know, the registration window for the Advanced Developer Certification Assignment opened at the end of last month and filled up within a matter of hours. Obviously this is disappointing for those unable to obtain a place as they've have already invested in the Certification process by taking the multiple-choice exam. I'm pleased to report that Salesforce's Nina Marinova has just posted on LinkedIn to say that the next registration will open this month:

Due to high demand, we will open registration for the next programming assignment window on January 30th, 2012. Candidates who have successfully completed the Force.com Advanced Developer multiple- choice exam and are current on their Force.com Developer Winter ’12 release exam will be invited to register for the assignment window at that time.
Assignments will be distributed in May 2012, and participating candidates will be given a month to submit their solutions. Candidates should plan to allocate a minimum of 20 hours to complete the assignment. Additional information will be available when we open registration.

This is great news as many people raised concern when the places available filled so quickly — especially difficult if you live in a different time zone to the eastern coast of the US. So mark the date in your diaries, people, or better yet set a reminder for yourself in your Salesforce.com org!