One of my absolute favorite conversations at Dreamforce this year happened during my last night in San Francisco. I was out until the wee hours of the morning with a group of people and happen to be fortunate enough to sit next to SteveMo and Adam Daw. For those of you that don’t know Adam, he’s a distinguished gentleman, and a fantastic Salesforce Developer that appreciates music, dancing, a fine snifter of armagnac, and a good cigar. I don’t think SteveMo needs any introduction, lets just say he’s “Salesforce famous” shall we? :)
Adam and I got to talking with Steve who mentioned to us that he will do whatever he possibly can to avoid having to “go to code” in his org. We wound our way through various analogies, and Steve mentioned that his fear is that in taking that leap of faith, there will be nothing there to catch him in the end. Adam’s answer was brilliant for two reasons:
- It referenced Indiana Jones and the Last Crusade
- I believe it to be 100% relevant
He referenced one of the last scenes where Indy finds himself standing at the edge of huge abyss with certain death waiting below but too far a leap to even consider trying. Indy hears his father’s voice in his head: “Only a leap from the lion’s head will he prove his worth.” Clutching his heart and taking a deep breath, he closes his eyes and steps out facing certain death, only to find that he’s landed on a very cleverly camouflaged stone bridge. It was all an optical illusion. He made the leap, and he was okay.
This prompted me to ask Steve: “As an admin who is unsure about taking this leap, what could we as developers say or do to show you it will okay?” Steve’s response wasn’t one asking for encouragement, it was one of education. He said, “What would help me perhaps, would be to see what a formula I’ve written looks like in Apex.” That got me to thinking that perhaps if that would help Steve, it would help others as well. So, hopefully next week, I will begin a mini series: “Beginning Apex Logic Through Formulas.” This won’t be anything you can directly “use” in your org and nor would I ever suggest that a formula be replaced with Apex, it’s merely meant to serve as a stepping stone for admins who want to get started coding. There is quite a bit of logic in formulas and if you can understand that, you’re halfway there already. The only thing left is to make that translation into Apex, which would be a bit like learning another language, not even a full language, maybe just a dialect.
So that being said, when Steve gets time, he will be sending me his first formula, (I’ve asked him to keep it simple — no fair stumping me on the first pass), but I’d like to open this up to other people as well. If you have a formula that you think would help your understanding of Apex by seeing it written out in code, let me know. I will do my best. I’m not even sure this will work all that well since there are some operations in formulas that are sort of “black boxes” of functionality, but lets take a stab at it and perhaps we can all learn something together.