877.703.4488 info@cloudmybiz.com
Tip of the Week – Debug Salesforce Apex Code in Eclipse

Tip of the Week – Debug Salesforce Apex Code in Eclipse

Developers, this week’s post is for you! If you’re a Salesforce developer, there’s a good chance you’ve tried (and maybe even given up on) the Salesforce plugin for the Eclipse IDE. The problem with Eclipse for Salesforce is that it just didn’t offer the same kinds of tools you’d expect from an IDE. Well, last year, Salesforce released an update that might be worth giving Eclipse another shot.

New in Winter ’16, Salesforce has released the Apex Debugger as an extension to the standard Force.com plugin for Eclipse. The tool is designed to behave similarly to debuggers available for other languages, giving you the ability to set breakpoints, view variables, and much more. This powerful tool might be just what you’ve been waiting for from Eclipse, and you should check it out today!

-Jared and the Salesforce Guys

P.S.: You might want to check out the video below for more info. The relevant section begins around 13:55.

Tip of the Week – Salesforce Field Sets make Visualforce more dynamic than ever

Tip of the Week – Salesforce Field Sets make Visualforce more dynamic than ever

One of the easiest things in the Salesforce world is updating a page layout. All you have to do is go to the page editor, drag and drop a few fields, and click save. Done! But this, unfortunately, only works for standard Page Layouts. If your business is leveraging Visualforce for any of your pages, you’ve probably learned that updating these layouts can get pretty complicated pretty quickly. Want to move a field to a different section, remove a field you’re not using anymore, or add a new one to the screen? Time to call the developers! Or, with a little creativity and a few Field Sets, you can have a Visualforce page that’s almost as dynamic as a standard page!

Leveraging Field Sets in Visualforce pages is surprisingly simple, and while Apex can supercharge your dynamic Visualforce code, you can use Field Sets without any Apex required. Begin by choosing an object, creating a new Field Set, giving it an easy-to-understand name, drag and drop the fields you want in, and click Save. Now, create a new Visualforce page. In your Visualforce, you’ll “repeat” through the fields in the field set to display those on the screen.

The example below is one of the simplest versions of this, but don’t think this is the end. Once you’ve got the basics working here, you’re ready to get really creative! Now go, sit down with your dev team, and make some awesome, dynamic Visualforce! And don’t forget to tell us about it!

<apex:page standardController="Account" standardStylesheets="true">
<apex:form >
<apex:repeat value="{!$ObjectType.Account.FieldSets.Account_Fields}"  var="f">
{!f.label}<br/>
<apex:inputField value="{!Account[f]}" /><br/><br/>
</apex:repeat>
<apex:commandButton id="saveBtn" value="Save" action="{!save}" />
</apex:form>
</apex:page>

-Jared and the Salesforce Guys

Tip of the Week – Use Named Credentials in Salesforce to simplify integration maintenance

Tip of the Week – Use Named Credentials in Salesforce to simplify integration maintenance

Integrations are integral when you want to take your Salesforce org to the next level. The integrations you use may be as simple as generating short links for SMS messages, or as complex as feeding live data between Salesforce and your accounting software or back-office data warehouse. If you’re a Salesforce developer, you’ve probably had to hard-code integrations over the years, leading to challenges in testing, deployment, and maintenance. If you’re a system administrator, you’ve probably had to deal with the annoyance of needing a developer to update code every time a simple endpoint changes. Many developers have learned these lessons the hard way and created custom settings to maintain integration settings, but this approach has its limitations. But have you heard of Named Credentials?

My team had favored the Custom Settings approach for quite a while, and when an incredible power user on Twitter built a bit.ly integration based on a question I posed to the #askforce community, I was introduced to the new Named Credentials tool released in Winter ‘16. Readymade out of the box, this cool tool is built with integrations in mind. They’re easier to set up and reference in Apex than Custom Settings, and maintenance is a breeze, allowing you to change endpoints without ever touching the code. Create a Named Credential by going to Setup -> Security Controls -> Named Credential. If you want to see how easy it is to incorporate into your code, check out the bit.ly integration above and Salesforce’s user guide. Admins and Developers alike, I know you’ll love this!

-Jared and the Salesforce Guys
Cover image by Joelle Diane

Tip of the Week – A bit.ly integration for Salesforce all from one tweet

Tip of the Week – A bit.ly integration for Salesforce all from one tweet

I know I rave about the Salesforce community. A lot. And for very good reason. A few weeks ago, I was asked if you could send shortened URLs from Salesforce. Sending them wasn’t the problem – there’s dozens of approaches there. But I didn’t quite have a solution for generating those links. I knew my team could figure it out quickly, but it was after-hours when the question came in and I wanted an answer fast. I turned to Twitter, and within a few minutes, I had several approaches lined up and could definitively say it was possible. The next morning, I awoke to an incredible blog post by Doug Ayers, who took my question as a challenge and stayed up late writing the code.

In short, his solution is brilliantly simple. First, you sign up for a free bit.ly account. In Salesforce, create a “Named Credential” (a tool designed for storing login credentials and endpoint URLs for integrations; Setup -> Security Controls -> Named Credential), then a Custom Field to hold your shortened URL. Next, copy and paste his Apex code – yeah, it’s ready to fly and very well-commented. Finally, use the Process Builder to create a Process, activate it, and test it out. Due to some known limitations with the Process Builder (if you need to do this in bulk, you could hit some problems), my team needed to swap that out for a Trigger, and a few other modifications were needed to make it fit into the process flow, but the hardest part was solved with just one tweet and the incredible #askforce community! Check out Doug’s post here, and enjoy this awesome solution!

-Jared and the Salesforce Guys
Cover image by Joelle Diane

Dreamforce Sock Update:

Dreamforce Socks

The socks are done! They look awesome, and feel even more incredible! I think I’ll be knitting another pair of Dreamforce socks next year, and I definitely plan on strolling around the convention in these!