Salesforce Lightning Example – Ideas Experiment

Salesforce Lightning Example – Ideas Experiment

Over the holidays I had some down time to dive more deeply into Lightning and create a sample application. I had already done a bunch of work around leads and cases, so I decided to use the Ideas capability as the foundation and place a new face on it with Lightning technology.

salesforce-lighting-ideas-example-brunswick

I focused on learning key aspects like Components, Controllers, Rendering Life Cycle, Expressions, Style, Events and Attributes to name a few and see how my existing skills (CSS & JS) could be leveraged within the framework. Big thanks to Jeff’s Douglas’s Lightning Blog Post Tutorial that provided a great sample to learn from.

Overall Thoughts

  • Scoping – nicely done using some Selector magic so that client markup from Components should not collide
  • Discrete Components – awesome future potential, as components can be designed to require well defined context / inputs
  • Style – no vendor prefixes. Did I mentioned no vendor prefixes? Not only does it save many lines of code, but my finger’s health appreciate it.
  • Events – structured way to have components react to one another in an loosely coupled manner
  • Attributes – great for not only storing basic values, but objects to be accessed in the controller without creating some global variable (for instance, many JS libraries assume very broad scope of variables)

Code in Action
The following video gives an overview of our code in action

A Few Highlights
I ended up using an Attribute of type Object to store a variable that is from a 3rd party library (Isotope), as it would generally be assigned to a global variable. It needed to be accessible once created in the controller for subsequent use and the Attribute worked nicely.

For sequential loading of JS and CSS libraries I used a load component from https://github.com/rajaraodv/loadcomponent

Install & Get the Code
1. Enable Lightning Components
2. Setup your namespace prefix (you will need to update the sample code to match this value [e.g.
3. Install the Unmanaged Package from https://login.salesforce.com/packaging/installPackage.apexp?p0=04tj0000000Jrpy
3. Update the prefixes in your code (by default I use JMB, update to reflect whatever you need)
4. Create an Idea in the OOTB UI to prepare some data to use in the UI
5. Use Workbench to execute some SOQL to get the CommunityId that your Idea was created within (e.g. SELECT Body,CommunityId FROM Idea)
6. Update line 18 in CardViewer.cmp to change ‘CommunityId’: ’09aj00000005dCsAAI’ to your CommunityID
7. Update CaseCards.app, CardViewer.cmp and VoteBox.cmp with your vendor prefix
8. Navigate to – https://naXX.lightning.force.com/yourprefix/CaseCards.app to run your app! (you will have to use the na instance for your Salesforce org)

A Peak at the Code
This is the main portion of our code and it illustrates how the various pieces come together to create the user experience.

Final Note
To make the sample more polished – we should use an aura:asyncRerender event to let our app know when an aura:iteration element is done rendering new data into the UI based on what you have done in the controller. In the sample code, we simply wait a moment and then perform other operations against the DOM to update it and assume that aura:iteration is done adding elements to the UI.

61 comments
mishkagupta
mishkagupta

They are highly professional and know how to make their clients happy. You need to give them the details of the venue of the party, and they will reach there within the time. Since, they are professional they know the meaning of punctuality. You can expect them at your place on time. They can offer you various types of service. They can be the entertainer, dancer, occasional bartender, and anything else in such kind of parties. They make the party an eventful place with their gorgeous presence all the time. These dazzling divas can make you feel extremely happy and proud as the host of such a lovely party Mumbai Escorts.


http://www.nightloverescorts.com/

http://www.nightloverescorts.com/escort-girls-services.html

http://www.nightloverescorts.com/model-escort-services.html

http://www.nightloverescorts.com/female-escort-services.html

http://www.nightloverescorts.com/indian-escort-services.html

http://www.nightloverescorts.com/mumbai-callgirls-Whataap-number.html

http://www.nightloverescorts.com/russian-escort-services.html

lilawatimhera
lilawatimhera

I am an intelligent and intellect university student offering you a sophisticated yet enticing experience of pleasure and fun. I can please your senses by talking dirty. Can you imagine your hands sliding down my silky skin and that is not all I have to offer. I have the curves which could kill. I have magic in my hands, I know how to tease, please and play. I Am very easygoing, playful and fun to be with. I always enjoy experimenting and I Am very sensual with a perfect pair of breasts that always just beg to be caressed. See you soon Mumbai Escorts.

http://www.mumbaiescorts.co/

http://www.mumbaiescorts.co/about.html

http://www.mumbaiescorts.co/gallery.html

http://www.mumbaiescorts.co/services.html

http://www.mumbaiescorts.co/rates.html

http://www.mumbaiescorts.co/contact.html

http://www.mumbaiescorts.co/links.html

indiragujariya
indiragujariya

A Sweet Girl with wonderful Natural breasts and a tight little butt just waiting to be cupped in your hands. She has the skin made for gentle touch and lips made to give pleasure. Indira Gujariya is a romantic type looking for a gentleman to swipe her off her feet with his charm, intelligence and class. If you consider yourself a respectable gentleman who can treat a lady properly, you should consider contacting Indira Gujariya and making her feel like the real woman she is. Indira Gujariya is open minded and is ready to girls Mumbai Escorts.

http://www.mumbai-escorts.net.in/

http://www.mumbai-escorts.net.in/about-mumbai-model-escorts.html

http://www.mumbai-escorts.net.in/mumbai-escort-pics.html

http://www.mumbai-escorts.net.in/best-mumbai-escorts-services.html

http://www.mumbai-escorts.net.in/mumbai-escort-rates.html

http://www.mumbai-escorts.net.in/mumbai-escort-whatsapp.html

trishakakkr
trishakakkr

My escorts service in Mumbai. include Sensual Massage combined with love making. I am quite expert in providing you sensual massage which takes all tension as well as stress from your body, but also infuse positive energy in you. My Massage service include tender touching your private parts of body , appreciating them through kissing as well as sensual love making to touch your inner soul and makes you realize what you want from life. Travel Companion. I have traveled to most of Parts of India and can be an excellent tour guide where you can have adventures in day like trekking, river rafting, ski falling, rock climbing and in night making wild love close to nature where no one bothers you with your stupid office work. Seductive Dancing. Arousing you with seductive dancing where I remove my clothes slowly on a soft music later sleeping in your strong arms where you treat me like a queen through gentle kisses and stroking my private parts Mumbai Escorts.

http://www.mumbaiindependentescorts.org.in/

http://www.mumbaiindependentescorts.org.in/about-us.html

http://www.mumbaiindependentescorts.org.in/mumbai-callgirl-photos.html

http://www.mumbaiindependentescorts.org.in/mumbai-escort-rates.html

http://www.mumbaiindependentescorts.org.in/erotic-service-mumbai.html

http://www.mumbaiindependentescorts.org.in/callgirls-whatsapp-number-mumbai.html

rachelmenon
rachelmenon

We will provide you with the most high profile women of the society they can be as per your requirement and as per the service you require in categories you want from different age groups college girls 18-22 (young and slim)` housewife 23- 35 model 19-29 (perfect figure) Call girls 18 TO 25 business women 25- 35 and much more they provide you with a complete exp and all that you require. we serve you 24-7 in Mumbai . so call now and have a ball of a time with with the most exotic escorts Call rachelmenon.com, do Not contact me with unsolicited Mumbai Escorts.

http://www.rachelmenon.com/

http://www.rachelmenon.com/high-class-escort-girls.html

http://www.rachelmenon.com/vip-model-escorts.html

http://www.rachelmenon.com/high-profile-female-escort.html

http://www.rachelmenon.com/mumbai-russian-escorts.html

http://www.rachelmenon.com/cheap-indian-escorts.html

http://www.rachelmenon.com/mumbai-callgirls-mobile-numbers.html


natashakeer
natashakeer

You have Googled Natasha Keer and you came to at my site. So you should come to my whatsapp number to contact me sexually, physically and inwardly. I would not let you down while expecting the cravings of yours and I serve all sort of official class, business class, Management Class whether wedded or unmarried between 21 to 65 years maturity. So following a monotonous day work you may come to me for a joy, peace and unwinding. So Being Kinky young lady I have learnt knead likewise to unwind every one of the muscles of yours expect a private on Hyderabad Escorts.

http://www.escortsinhyderabad.info/

http://www.escortsinhyderabad.info/about.html

http://www.escortsinhyderabad.info/gallery.html

http://www.escortsinhyderabad.info/rates.html

http://www.escortsinhyderabad.info/links.html

http://www.escortsinhyderabad.info/contact.html


salonitelin
salonitelin

Hyderabad Escorts has established a high value, high grade, highly educated service group all workers have a higher quality, very, very good connection abilities, good looking and are subject to the company firm benchmark induction. It is an erotic Escorts in Hyderabad which not just feels wonderful but is likewise an outstanding to your physical and passionate well being Hyderabad Escorts.

http://salonihyderabadescorts.in/

http://salonihyderabadescorts.in/about.html

http://salonihyderabadescorts.in/gallery.html

http://salonihyderabadescorts.in/fees.html

http://salonihyderabadescorts.in/contact.html

http://salonihyderabadescorts.in/links.html


lelaji
lelaji

I Am Lela Ji And I Am here to please you and your deepest desires. I provide a fun, discreet and satisfying experience. I Am a independent, clean, curvy blonde with a beautiful face to match. accept All men or unknown numbers. I also do not send Photos my safety is important as yours Hyderabad Escorts.


http://www.escortinhyderabad.net/

http://www.escortinhyderabad.net/contact.html

http://www.escortinhyderabad.net/gallery.html

http://www.escortinhyderabad.net/rates.html

http://www.escortinhyderabad.net/links.html

kamligajre
kamligajre

Hyderabad Escorts Service has become so much prevalent among the travelers and tourists that whenever they pay visit to this city they do not forget to revitalize their mind and soul with the escorts available here. Some of the escorts agencies working here are at the tip of the tongue of most the customers because these agencies make available high profile Hyderabad Escorts.

http://www.escortagencyhyderabad.org/

http://www.escortagencyhyderabad.org/about.html

http://www.escortagencyhyderabad.org/gallery.html

http://www.escortagencyhyderabad.org/rates.html

http://www.escortagencyhyderabad.org/contact-me.html

http://www.escortagencyhyderabad.org/links.html

reenasingh
reenasingh

Just give me a call for a Happy Hour Special Service. You can request any other services, and you don’t have to be embarrassed to ask us what you want. If we can do anything to make your stay happy, we will be pleased to do it, and we promise 101% satisfaction Mumbai Escorts.

http://www.mumbaiescortmania.com/

http://www.mumbaiescortmania.com/about.html

http://www.mumbaiescortmania.com/gallery.html

http://www.mumbaiescortmania.com/services.html

http://www.mumbaiescortmania.com/rates.html

http://www.mumbaiescortmania.com/contacts.html

http://www.mumbaiescortmania.com/mumbai-call-girl-whatsapp-number.html

manshigupta
manshigupta

Our Mumbai Escorts has beautiful, young models and top class companions-to Satisfy you in every way you want. Most of the girls in Mumbai Escorts agency meets only visiting business men, tourist and local experts. Not all our Independent Escorts agency wants to have their images published as they want there secrecy, but we would be pleased to inform you about them upon your request Mumbai Escorts. http://www.mumbaicityescort.in/

karthikornalies
karthikornalies

 Hello


Facing some issue while installing the package on my dev org. Just wondering, if we have to have the JMB Static resources uploaded prior to installing the package.


This app can't be installed.
There are problems that prevent this package from being installed.

No Event Named markeup jmb static resourcesloanded found markuo cardviewe
Any thoughts on what i'm missing would be great.

Dilip Singh
Dilip Singh

@John Brunswick - very nice post, thanks a lot for this. Have a query - why it is domain dependent.. why can't EU instances access this ?

coder312
coder312

Hi @John Brunswick -


We are getting the following error even though we've removed the references to your namespace.  Can you please help?


Uncaught TypeError: Cannot read property 'fire' of undefined

vppravi93
vppravi93

Hi,its a grear post john.But package inatallation doesn't seem to work.It show this message

No EVENT named markup://jmb:staticResourcesLoaded found : [markup://c:CardViewer]

dancinllama
dancinllama

This is a great post and I'm looking forward to diving more into the components.  I see others have also had the installation failure for the unmanaged package.  I think it'd be helpful to at least add the link to your github repository in the post above.  Also, Andrew Fawcett wrote a useful "github to salesforce" deployment button, which you could use in lieu of the unmanaged package until you resolve the installation issue.  Here's the link for that: http://andyinthecloud.com/2013/09/24/deploy-direct-from-github-to-salesforce/

hinarayan
hinarayan

@dancinllama I have the same problem of not being able to use the GitHub code or the unmanaged package to leverage the cool SFDC ideas capability. Can somebody share the latest code so that it can be installed on a dev sandbox?@John Brunswick 

brianromanowski
brianromanowski

How could attaching a file be added when creating an idea?

brianromanowski
brianromanowski

@John Brunswick @brianromanowski Thanks John, I actually found that and got it working yesterday. Now I'm trying to figure out how to filter with Isotope. I've added a class to the isotope card for the status and I want to filter on it. Filtering on the class itself seems easy but filtering based on the value of the class is difficult, Most of what I've found is for filtering on a numerical value(i.e.>50 votes), not for text like ideas in the submitted stage.

brianromanowski
brianromanowski

@John Brunswick

Figured it out. I changed the class for the card Div to include the field I want to filter on and then you can just change the filters in the controller.


                  <div class="{!'card box-shadow-outset '+ p.Stage}" onclick="{!c.openIdeaDetail}" data-ideaid="{!p.Id}">


moshekarmel1
moshekarmel1

I ran into some issues with opening the detail for a card. The Id getting passed in was undefined. When I changed this line


<div class="card box-shadow-outset" onclick="{!c.openIdeaDetail}" data-ideaid="{!p.id}">


To 


<div class="card box-shadow-outset" onclick="{!c.openIdeaDetail}" data-ideaid="{!p.Id}"> 


Everything started working again. Seems like there is some case sensitivity.

brianromanowski
brianromanowski

Hi John,

I've been trying to work with the source on github but there appears to be missing components. Are you going to be updating it? Specifically the renderHTML and CommentHTML.'

Thanks!

brianromanowski
brianromanowski

@John Brunswick Thanks John. Almost there. 


There's something going on with the onclick for openIdeaDetail. The modal for the idea doesn't show. I've placed a window.alert before and after the evt,setparams on it and it only works before, not after. Also if I comment out the evt.setparams I get the modal showing with the description and comments.


Also there was a typo in the cardviewer component, title was lowercase and was case sensitive for me:


<div class="carddetails">

                          <img src="{!p.Merchants__PhotoURL__c}" class="profilephoto"/>

                            <aura:if isTrue="{!p.NumComments > 0}">

                                <div class="commentcount">                           

                                    {!p.NumComments}

                                </div>

                            </aura:if>                                    

                            <h3>{!p.Title}</h3>

                            <p>

                                by {!p.Merchants__Submitted_By__c} <span class="timeago case-date" title="{!p.CreatedDate}">{!p.CreatedDate}</span> 

                            </p>

                        </div>