Show Lightning component on public website without authentication

How to show Lightning component on public sites without need of user authentication

I have posted few articles on Lightning OutIn 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.

For this post, I will consider Text slider component created in this post. Using this same method, I have displayed Live demo of Lightning component on wordpress blog. Continue reading “Show Lightning component on public website without authentication”

Text Slider Lightning Component for Salesforce with Live Demo

How to use Nested Components and create a simple yet powerful Text Slider Component in Lightning for Salesforce

In this post we will create simple and powerful Text Slider Component in Lightning.

Below are list of all features supported by this Component

  • Its pure CSS based without any JavaScript libraries therefore super fast
  • Long contents are auto scrolled with nice overloaded CSS for scroll bars
  • Ability to set Header and Body Text for each slides
  • Enable or disable auto background colors
  • Enable or disable auto slideshow
  • Control slides delays in case timer enabled
  • If auto background color turned off then ability to control background and text color
  • Slider contents are un-escaped means we can render richtext content

Continue reading “Text Slider Lightning Component for Salesforce with Live Demo”

Design Continuation Server in Salesforce

How to implement Continuation Server in Salesforce with the help of Action Function and Continuation Object

Continuation Server using ActionFunction in Salesforce
Continuation Server using Action Function in Salesforce

If you are new to Continuation Object in Salesforce then would suggest to read introduction post first. In last post, we discussed how to implement limitless chaining of Continuation Object using JavaScript remoting. In this post, we would try to achieve same, but instead of using JavaScript remoting, we would be using ActionFunction.

Why do we need chaining of Continuation Object

  • From Apex, we can only chain 3 Continuation Object
  • If we call API synchronously, chances are very high that it will run for more than 5 sec and contributing towards Concurrent Apex limit
  • Getting CPU timelimit error is also high
  • Making synchronous call also means risking scalability of Salesforce instance
  • You don’t want user to wait till call out completed, let them work and update user interface once response is received

Continue reading “Design Continuation Server in Salesforce”

Limitless Chaining of Continuation object in Salesforce

How to create a Continuation Server in Salesforce with the help of JavaScript remoting and Continuation Object

Chaining of Continuation Object in Salesforce
Chaining of Continuation Object in Salesforce

Around two years back, I posted an article on Continuation Object in Salesforce. As we know because of governor limits like concurrent Apex limit or CPU time limit errors, its always recommended to perform long running Apex process asynchronously. Processes specially like calling external API.

We can come up with multiple designs if number of APIs are less. However, you would risk scalability of Salesforce if number of APIs to be called is 10+. We cannot use chaining of continuation object directly as currently its limited to 3. If we call these API’s from Javascript (like using JavaScript remoting) then still we are using synchronous Apex which would be trade off for scalability.

What happens when we try to chain more than 3 Continuation Object call
What happens when we try to chain more than 3 Continuation Object in Salesforce

In Short, below are challenges in front of us

  • We need to call 10+ API from Visualforce
  • Cannot use chaining of Continuation Object as current chaining limit is 3
  • Cannot invoke each API from JavaScript remoting because it will be considered as Synchronous Apex

Continue reading “Limitless Chaining of Continuation object in Salesforce”

Getting started with Salesforce DX – Salesforce Developer Experience

Introduction and basics of Salesforce Developer Experience (Salesforce DX) with source code and Video tutorials

Important : At time of writing this post, Salesforce DX is in pilot phase. Mostly any product in Salesforce goes from Pilot to Beta and then Generally available. There is no guarantee that if this product is released, it would work like exactly same as written in this post.

If we already have Salesforce Metadata API, Force.com IDE and other tools then why do we need one more tool like Salesforce DX ?

In tools like Changeset, Metadata API or Force.com IDE, source of truth is Sandbox. Although we can setup process and continuous integration (CI) to use some source code management (SCM) like Git or SVN. However these kind of setup takes time, expertise and lot of effort.

Salesforce DX not only solves above problem but

  • Ability to consider SCM as source of truth
  • Use any favorite IDE or any SCM
  • Powerful CLI to help minimizing complexity of setting up CI
  • Updated Force.com IDE to support Salesforce DX if you are not comfortable with CLI
  • and most important, spin off Scratch Orgs within minutes through script to quickly work on POC or package based development

What are scratch Orgs ?

Salesforce DX can be enabled for any Salesforce instance and they are known as Developer Hub. One Developer Hub can have multiple Scratch Orgs. Scratch Orgs are temporary Salesforce org which can be created quickly and metadata can be deployed from SCM. These kind of Orgs can be used by developers to perform quick proof of concept or build and test packages. Once package is build and saved back on SCM, scratch org can be destroyed easily. Continue reading “Getting started with Salesforce DX – Salesforce Developer Experience”

Behold Yourself – Summer 17 is here to break legacy Visualforce Navigation code in Lightning Experience

In Summer 17, URLFOR method in Visualforce would not work in Lightning Experience if used directly. Even sforce.one API is not fully compatible.

You read it right. Its not Locker Service that may break your code, but Summer 17. If you have legacy Visualforce page, which needs to navigate to Lightning experience and URLFOR is used directly, then chances of getting below error are very high.

Salesforce Summer 17 - URLFOR Not working
Salesforce Summer 17 – URLFOR Not working

In above screenshot, I got MALFORMED_ID : malformed Id error in one of my Visualforce, where I needed to navigate to new Account record. Continue reading “Behold Yourself – Summer 17 is here to break legacy Visualforce Navigation code in Lightning Experience”

Export or print code review feedback generated by Salesforce Lightning CLI

How to print or export code review feedback report generated by Salesforce Lightning CLI tool

Update : We can use this heroku app to scan Lightning component online and get code review feedback. Complete source code is available here. We don’t need to install Lightning CLI until its project compliance issue.

Salesforce Lightning Component - Code review - Javascript lint
Salesforce Lightning Component – Code review – Javascript lint

In this post, we discussed that how Lightning CLI can be used to get a code review information of custom Lightning component. However, code review is either printed or exported as a file in text or JSON format. Question is, how to get Lightning component code review feedback in HTML or PDF format ?

I tried various options available here however there were no way to export code review feedback generated by Lightning CLI. Output generated by Lightning CLI is not presentable to business executives or clients.

Finally, I came up with very simple Heroku application, which can be used to get Lightning CLI code review feedback in HTML or pdf format. We need to run below command to get CLI code review in JSON format. Continue reading “Export or print code review feedback generated by Salesforce Lightning CLI”

Use Lightning Components on external websites – Lightning Out

How to use Lightning component in node.js (External websites) by using Lightning Out. It shows how to enable CORS and SSL in Node.js with Video and complete source code.

If you were the users of IGoogle, few years back, you would be excited to know that web development is progressing in that direction. Architect of web application development is getting shifted towards component based development by introducing concepts like Web Components and frameworks like polymer and Lightning Components. One of the possible use case of component driven development is ability to use whole component externally. In IGoogle, components were built by partners and then was exposed as widgets to be used on your custom Google home page. Salesforce product team, being visionary came up something like this by introducing Lightning Out. With the help of Lightning Out, we can surface our existing Lightning Component to external websites. Previously, we already discussed that how Lightning components can be used on Visualforce pages using Lightning Out.

Let’s see how we can do it. Continue reading “Use Lightning Components on external websites – Lightning Out”

Generic and Responsive Table Component in Salesforce Lightning

Complete Source code to create generic and responsive Table component in Salesforce Lightning

Almost one year ago, I wrote this article to demonstrate how to create a responsive datagrid component in Lightning. Recently, when I went back to the post, I realized that responsive table component in Lightning could be a lot more easier. So, lets see easier and efficient approach to create a Responsive and Generic Table component in Lightning.

First and foremost, we need to provide data in below JSON format to Lightning component, everything else would be taken care by component itself.

JSON format for responsive datagrid Lightning component
JSON format for responsive data grid Lightning component

Continue reading “Generic and Responsive Table Component in Salesforce Lightning”

SFDCRules – Simple yet powerful Rule Engine for Salesforce

Open source project to evaluate rules in Salesforce using Apex

Coming from Java background, we know that there are many open source or free Business Rules Management System (BRMS) tools that can be used like Easy rules or Drools. I was in search of such tool for Salesforce but didn’t find any. There are few AppExchange BRMS products however they are paid and heavy in terms of features needed. Who don’t love free stuff 🙂 and wanted it free and open source. While searching, I came across this post of Martin Fowler and it encouraged me to write my own rule engine for Salesforce.

So, here it is. Free, light weight, basic but powerful rule engine written in Apex for Apex. Continue reading “SFDCRules – Simple yet powerful Rule Engine for Salesforce”