How to design a Visualforce page so that It would be displayed properly in classic as well in Salesforce Lightning Experience
This topic was subset of my presentation in Salesforce Boston World Tour 2017. Sometimes we find our-self in situation where custom Visualforce page should be displayed with Old theme in classic but with Lightning theme in Lightning Experience.
If you can convince client to use same user interface in classic and Lightning, then it would be an ideal approach. Even Salesforce displays classic user interface for many setup pages inside Lightning experience.
Parallel execution of browsers in Selenium with the help of TestNG and determining maximum operating capacity of custom code in Salesforce
When we build any custom solution in Salesforce, key is to write an efficient and meaningful Apex test classes for sure. However sometime we may need to test how custom application would behave in maximum operating capacity. Here, I am talking about Load Testing of custom applications built on top of Force.com platform. Recently I needed to push my code to its limit to know how many concurrent users can use it before hitting any governor limits. Quickly I realize that its time to call my friends Selenium and TestNG.
Before doing any extensive stress or load testing on Salesforce, we must need to contact Salesforce support and explain them what we are trying to achieve. More detail available in this official Salesforce blog post.
Using Salesforce ANT Migration toolkit to retrieve and deploy custom metadata types with record. Sample Package.xml and ANT script included.
Most of you must already know that there is new way to control your program behavior in Salesforce with the help of Custom Metadata Types. Previously we were using List Custom Settings to create functionalities like managing Trigger’s On/Off behavior or controlling Integration endpoint URLs. However we were not able to use Migration tools to import export records into custom settings.
So, into the new world of Custom Metadata Types, I used change sets mostly to perform deployments. Recently, I needed to use ANT migration toolkit to retrieve and deploy Custom Metadata Types. I was able to do it however If you ask me, I spent more time then expected.
Received errors like :
package.xml - Entity type: 'CustomMetadata' is unknown
Online free Housie / Tambola / Bingo Game. Simple to use and play with Bingo Number descriptions
Its not education , technical or Salesforce related post. Its source code of Family fun game Tambola.
This weekend, we all friends gathered together to play one of most famous Indian game Tambola. This game is also known as Housie or Bingo. Normally there is central pot where numbers between 1 to 90 placed in piece of paper or plastic balls. Host reveals numbers one by one by randomly selecting those balls or piece of papers from pot. Problem for us were, we all have children and there is no way they will allow us to play with this way. Instead of host picking numbers, our kids would have been played with those. So what I did is, simple HTML page with random number generator between 1 to 90. Plugged my laptop to chromecast and voila, everyone in room playing traditional game in modern way 😉 Continue reading “Housie / Tambola / Bingo Game Number Generator”
Best Practices for Salesforce Lightning Component. How Lightning Data Service can improve Lightning Component performance and solve inconsistent data problem without writing single line of Apex code. Demo source code, image and slides included.
If you have worked on Visualforce and started playing with Lightning Component, you must have identified one important missing feature, which is standard Controller.
Lets assume a scenario, you have two Lightning Components on Account page. One Lightning Component is used to show some fields and other component is used to edit same record.
Problem 1 :
To achieve this, both Lightning components would invoke Apex method separately at the cost of performance, by issuing duplicate server calls. Below image depicts problem, where multiple Lightning component requests same content by making separate server calls.
Example of using Hierarchy custom settings in formula field, custom button, process builder and workflow rules. Youtube video included.
Avoiding hard coded Ids or values from formula field, custom button, process builder, Workflow rules or Approval process using Hierarchy custom setting is not something new. This idea exists from many years in Salesforce ecosystem. However, some times I have seen developers and admins debating on same question, so though to put a consolidated blog post on same.
Why you should avoid hard coded values or Ids in Salesforce ?
Answer is very simple, maintenance. When sandboxes are refreshed or metadata deployed to different instances, admins would need to change values manually. If we are talking about manual post deployment step, then we are also talking about nightmare of maintaining list of manual post build steps.
Can we use Custom Labels to avoid hard coded Ids / values in Salesforce ?
Technically yes, but I would suggest not to use custom labels in Salesforce to avoid hard coded Ids because of below Issues
Dataloader does not support custom label bulk load / restore / export
Imagine there are 100’s of custom label and it needs to be different for each Salesforce instances. You would be left either with manual step or some external tool which may not be allowed / approved by customer.
Hierarchy Custom Settings to Rescue
If you are from Java / C#, consider Custom setting as resource file. Here, you would store information about your application which doesn’t change frequently and controls behavior of application. There are two types of custom settings
List Custom Setting
This custom setting is equivalent to custom / standard object. We can store values in tabular format.
Hierarchy Custom Settings
This custom setting can be used in formula field, process builder, custom button, Workflow rules or Approval process.
Most unique feature about Hierarchy custom setting is that we can have different values at Organization level, profile level and user level.
Custom setting can be used in formula fields using global variable $Setup. Syntax to use custom setting is
Highest priority is given to value defined at user level then profile and at last organization level.
How to show Lightning component on public sites without need of user authentication
I have posted few articles on Lightning Out. In this post, we will see how Lightning components can be displayed on public website. To access these Lightning components, users don’t need to login to Salesforce.