Lightning Component for Dropbox

Hi All,

Today i will be showing you DropBox Lightning Component created by me and my colleague Balkishan Kachawa.

Dropbox is a file hosting service operated by Dropbox, Inc., headquartered in San Francisco, California,
that offers cloud storage, file synchronization, personal cloud, and client software. There are limits in storage of files in Salesforce. If you need a secure and free storage space for your files, you can use DropBox Lightning Component to store files directly in your DropBox app from Salesforce.

Features of this Lightning Component are :

  1. You can use this component on any sObject.
  2. You can store files for a specific record.
  3. You can upload multiple files.
  4. You can delete files directly in DropBox.
  5. You can view you files.

Click here to install Manage Package in your org.

After installing package register for My Domain.

Make sure you have DropBox Account. If you don’t have you can sign up and create DropBox App as below.

Sign up Dropbox account from DropBox website.

After the Sign up login into your dropbox account and then create a Dropbox App using following steps:

Go to on dropbox developer edition i.e.
Click on My Apps > Create App.
Then fill all information about app and then click on create. See below screen shot.


Manage Dropbox Key from Custom setting

Insert a record in custom setting using following steps:

  1. Navigate to Setup > Develop > Custom Settings, click on Manage of “Dropbox Key”.
  2. Click on New, than insert following value:

App Key : from DropBox App

App Secret : from DropBox App

Redirect URI : from salesforce <your domain>/apex/DropBoxOAuth or copy url from preview of DropBoxOAuth page.

isAuthentication : false

Click on Save.

Add Redirect URI in Dropbox App

To add Redirect URI, Open your Dropbox App and you must set auth2 Redirect URIs same as above Redirect URL.

That’s It.

Your final result will look like this:

Breadcrumbs using Component Event in Lightning Component

Hi All,

In this post I will tell you how to use Breadcrumbs using Component Event.

A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the bubbled event.

This can be useful when trying to breabcrumbs in component and We’ll see how to attribute is used for firing and handling events by using <aura:registerEvent>. Register Component Event is registers that it may fire an event by using in its markup.

When complete it will look like these screenshots:

Let’s walk through code.

BreadcrumbContainer.cmp :

<aura:component implements="force:appHostable">
    <aura:attribute name="FixedBreadcrumbs" type="String[]" default="Home,Bread,End"/>
    <aura:attribute name="Breadcrumbs" type="String[]" default="Home"/>
    <aura:attribute name="itemName" type="String" default="Home"/>
<div class="breadcrumb">
        <aura:iteration items="{!v.Breadcrumbs}" var="menu" indexVar="i">
            <c:BreadcrumbContent index="{!i}" menu="{!menu}" cmpEvent="{!c.setNavigationEvent}"/>
<div class="container">
        	This is <b>{!v.itemName}</b>  Breadcrumbs</div>
<aura:if isTrue="{!v.FixedBreadcrumbs.length > v.Breadcrumbs.length}">

<ui:Button label="Next" press="{!}" />


	setNavigationEvent : function(component, event, helper){

        var index = event.getParam("navIndexEvent");
        var navbNew = [];
        var navb = component.get("v.FixedBreadcrumbs");
        for(i=0; i<=index; i++){
    next : function(component, event, helper){
        var navb = component.get("v.FixedBreadcrumbs");
        var navbNew = component.get("v.Breadcrumbs");
        var len = navbNew.length;


.THIS.breadcrumb {
    padding: 20px;
    background-color: antiquewhite;
    margin: 13px;
    border-radius: 5px;

.THIS.container {
    text-align: center;
    font-size: 22px;
    margin: 15px;
    padding: 20px;
    background-color: peru;
    border-radius: 5px;

BreadcrumbContainer is component parent component of BreadcrumbContent.


<aura:component >
	<aura:registerEvent name="cmpEvent" type="c:CmpEvent"/>
	<aura:attribute name="menu" type="String" />
    <aura:attribute name="index" type="integer" />
    <a onclick="{!c.setNavigation}">{!}</a> ❱


	setNavigation : function(component, event, helper) {
        var cmpEvent = component.getEvent("cmpEvent");
        var index = component.get("v.index");

        cmpEvent.setParams({"navIndexEvent" : index});;

In this component i am using <aura:registerEvent>.


<aura:event type="COMPONENT" description="Event for set Index No." >
    <aura:attribute name="navIndexEvent" type="integer" default=""/>

This is a Event with the type of COMPONENT.


Lightning Component Bundle Concept

In my last post I showed how to use Nested Component in Lightning Component. In this post, I will be showing you some basic concept of Controller, Helper and Renderer oof Component Bundle.



This is a client-side Controller. A client-side controller handles events within a component. It’s a JavaScript resource that defines the functions for all of the component’s actions.
Each action function takes in three parameters i.e. Component, Event, and Helper. A client-side controller is part of the component bundle.
It is auto-wired via the naming convention, <ComponentName>Controller.js like: DemoController.js here Demo is Component Name.

  • Component : component to which the controller belongs.
  •  Event : event that the action is handling.
  • Helper : helper if it’s used for calling helper method.

In the controller we can call function directly from action of component like: {!c.doSomething}. We can calls helper function from controller function with helper keyword.

Example :

Demo.cmp : This is Component of Demo Bundle

<aura:component >
    <ui:button label="Do Something" press="{!c.doSomething}"/>

DemoController.js : This is Component Controller of Demo Component Bundle

    doSomething : function(component, event, helper) {
        alert("This is my Controller function");

Note : we can’t call controller’s funtion or recursion funtion itself.


Hepler is server-side Controller. It is usually use for firing server-side actions and process data or tasks. we can called Helper’s java-script function from a client-side controller or renderer. It is also part of the component bundle. A helper function can pass in any arguments required by the function, such as the component it belongs to, a callback, or any other objects.

It is auto-wired via the naming convention, <ComponentName>Helper.js like: DemoHelper.js here Demo is Component Name. The helper function calls an Apex controller method and queues the action. The Apex method is invoked and data is returned.
A JavaScript callback function is invoked when the Apex method completes. The JavaScript callback function evaluates logic and updates the component’s UI.

From above example we need to add some statement i.e.

DemoController.js : This is Component Controller of Demo Component Bundle

    doSomething : function(component, event, helper) {
        //Calling helper function

DemoHepler.js : This is Component Helper of Demo Component Bundle

    doSomethingHelper : function(component, event, helper) {
        alert("This is my Helper function");

If we want to reuse funtion in the component put it into helper. Hepler we can call helper’s funtion or recursion funtion itself.

Note : we cannot call Helper’s function directly from action of component like: {!c.doSomething}

Renderer :

Renderer is client-side Controller. It’s a JavaScript resource that defines the functions for all of the component’s actions.
Each action function takes in two parameters i.e. Component and Helper.It is auto-wired via the naming convention, ComponentName>Renderer.js like: DemoRenderer.js here Demo is Component Name.

The rendering lifecycle automatically handles rendering and rerendering of components whenever the underlying data changes. Here is an outline of the rendering lifecycle.

When an event is fired, it may trigger actions to change data and call rerender() on affected components. The rerender() function enables components to update themselves based on updates to other components since they were last rendered. This function doesn’t return a value. The framework automatically calls rerender() if you update data in a component. You only have to explicitly call rerender() if you haven’t updated the data but you still want to rerender the component. You generally want to extend default rerendering by calling superRerender() from your renderer() function before you add your custom rerendering code. Calling superRerender() chains the rerendering to the components in the body attribute.


DemoRenderer.js : This is Component Renderer of Demo Component Bundle

    render : function(component, helper) {
        var ret = this.superRender();
        //Calling Helper function
        return ret;