Advance Apex debugging in Salesforce and best practices – Videos

While developing applications on Force.com platform using Apex, I am sure you may have been in need of debugging your code. Salesforce being cloud platform, method to debug code is very different as compared to other programming languages. In this post we will discuss all about Apex code debugging, challenges, solutions and other best practices.

Salesforce Advance Apex debugging

Salesforce Advance Apex debugging

How many ways to debug Apex code

  1. Eclipse Force.com IDE
  2. Debug log
  3. Developer console
  4. Fetch debug log using Tooling API

Continue reading

Continuous Integration in Salesforce using Flosum AppExchange

This is first of many upcoming articles on evaluation of Salesforce AppExchange products. In this post we will be discussing capability of native Force.com based solution for Continuous integration. Deployment has always been one of pain point in Salesforce developement. I have worked and proposed many solutions to customers based on their requirement and budget. One of solution which got my attention recently is “Flosum” available and listed on AppExchange from this year.

I have used many traditional continuous integrations like Jenkins, Bamboo, Scheduled ANT script but all of them still involve manual intervention and most important, special skill set to setup and handle any issue arising time to time.

Let’s talk about Flosum and what makes it different at high level:

  • Complete native solution built over Force.com platform
  • Requirement gathering to deployment, all aspects covered
  • Multiple environment management
  • Easy Profile migration
  • Security access to environment for each user
  • Default space 11GB
  • Acts as Version Control
  • Supports Continuous integration and auto deployments
  • Compare Complete Org with historical or current changes
  • 360 reporting view

Continue reading

Top Google chrome extensions for Salesforce

1. Salesforce Developer Tool Suite

First in my list is “Salesforce Developer Tool Suite” by concret.io.

Does it takes a lot to view debug logs i.e. via setup area or dev console. This extension is an attempt to make this use case simple, by making debug logs visible in 2 clicks, without leaving the current Salesforce tab. Plus, you get a better hierarchical view of debug logs, which are better to analyse.

I have lots of expectation from this extension as this is the one of extension which takes feedback actively (You can find discussion tab just inside app) and frequently releases new capabilities. More features, like Execute Anonymous, Code Coverage, Test Cases are in pipe, will be released soon.

Chrome extension - Salesforce Developer Tool Suite

Chrome extension – Salesforce Developer Tool Suite

install it from here. you can find more about this extension on company blog page.

2. Salesforce Navigator

Second in my list is “Salesforce Navigator” and I cant live without it a single day. On average, it saves more than 50% of my clicks needed for administration. My shortcut for this utility is “Ctrl + Alt + Space” and I guess this most used combination on my system. Using this utility, you can directly navigate to any setup page like Object, Apex class, Pages, Workflow rule etc.

Salesforce Navigator - Google Chrome extension

Salesforce Navigator – Google Chrome extension

install it from here. Continue reading

System mode or God mode in Apex – Gotchas

In many of my previous implementations I have used advantage of Apex code running in System mode however never tried how far it can go in terms of capabilties. There is no specific Salesforce documentation which can explain that what is allowed or not allowed in System mode.

In this post, we will go through some scenario and will try to understand what really is possible in Apex System mode and when it can fail.

Before diving more lets discuss how many types of mode do we have in Apex ?

User Mode : As per this Salesforce post, all Profile level permissions, sharing rules and Field level security are enforced in Apex if it runs in User mode. Standard Controller and Anonymous Apex runs in User mode.

System Mode : Same post conforms that custom controller, trigger, Apex class, controller extension works in System mode. Means eventhough user does not have necessary profile level permission, record level permission or field level permission, but still they can perform any operation on it.

Continue reading

Salesforce to Salesforce integration using Named Credentials in 5 lines

I have already written article to integrate Salesforce with other Salesforce instance around 3 years back. In last 3 years, Salesforce has changed a lot. This time I will integrate Salesforce with other Salesforce only only in 5 lines of code, can you believe it  :) ? Check my old article, and its around 50+ lines of code with security control.

What is Named Credential ?

A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. You can simplify the setup of authenticated Apex callouts by specifying a named credential as the callout endpoint. You can instead specify a URL as the callout endpoint and register that URL in your organization’s remote site settings. In that case, however, you handle the authentication in your code. Doing so can be less secure and especially complicated for OAuth authentication.

Long description short , “using Named Credential, we can make call out to external system without supplying username or Password”.

Continue reading

Using soapUI with Salesforce to test standard and custom web services response

soapUI is most common tool available to test Soap based web services, it also has capability to test REST web services. soapUI can be used to test Partner WSDL, enterprise WSDL, Tooling API, Metadata API to study capability and response from Salesforce before writing any code in Java, C# or any other language. In this article we will see, how we can leverage this tool to test enterprise WSDL from Salesforce.

You can download latest version of soapUI from here.

Continue reading

Create collapsible panel component in Lightning

In previous blog post, we saw that how Lightning component bundles are related to each other and how to create simple Hello World component.

In this post, we will create very simple yet powerful reusable lightning component for collapse and expand panel. This time, we will skip basics of lightning and directly start with code.

Complete component is build with plain javascript and CSS, no library used.

Lightning CollapsiblePanel Component - Collapsed

Lightning CollapsiblePanel Component – Collapsed

Lightning CollapsiblePanel Component - Expanded

Lightning CollapsiblePanel Component – Expanded

 

Continue reading

Continuation object in Apex – Asynchronous callouts for long running request – Live Demo

We may run into scenario in Salesforce project, where we need call external web service but no need to wait for response. Response from external web service can be processed asynchronously and once processed it can be presented in Visualforce page.

We can accomplish this by using Actionsupport or Javascript remoting. However, this is possible with using Continuation method as well.  In Continuation approach, we can call external web service and inform that which callback method should be used to  process response. After execution of callback method, data is presented in visualforce page.

Execution Flow of an Asynchronous Callout - Image from Salesforce documentation

Execution Flow of an Asynchronous Callout – Image from Salesforce documentation

Below code demonstrate complete usage of this.

Continue reading

Getting started with basics of Lightning Component

As you might already know that next big change in Salesforce is introduction to lightning components. As technology is changing rapidly and to take advantage of cutting edge innovations in web technology, Salesforce doesn’t want to stay behind. If we see trend, all major platform has introduced component based design like Polymer, React, Web Components, Angular 2.

We will be discussing basics of Lightning components in this post and how Lightning application, component, controller, helpers and Apex controllers are connected with each other.

Lightning components are based on open source UI framework for web development. Every Salesforce organization already has aura documents available in their instance and can be opened by navigating to http://instance.salesforce.com/auradocs. You can also visit my other blog post explaining FAQ of lightning and Lightning Trailhead module.

In below image, I have tried to explain at high level, how different JavaScript files are related in Lightning components, there are many other parts as well, but I tried to keep it short and simple.

Getting started with lightning components

Getting started with lightning components

Continue reading