Skip to main content

Posts

Showing posts from 2016

Salesforce - Lightning Components in Communities

Recently I built a Lightning component, tested it with as in internal user, and it was beautiful. Everything worked as expected. The work was turned over to the project manager to demo to the client. During the demo nothing worked, just errors. After the demo I received the call. “What did you build? Why didn’t it work?”     I couldn’t understand what had happened. I asked him to show me how he had demonstrated it. He went straight to the community builder, plopped my component on the page, and ERROR! Unbeknownst to me the recordId does not pass to lightning components in the community the way it does as an internal user.
Now you get to learn what I learned.
The problem: Force:hasRecordId does not work in community builder.
The Record ID is not passed by default in the community builder. However, there is a workaround to use it.
The Solution: In your component add force:hasRecordId. This is not needed for community builder; however, it ensures it still works in the internal org as …