Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [lightning]

This tag is for questions related to the "Lightning Experience" which comprises a number of elements around a new User Interface on the Salesforce Platform. While it can still be used in a server side MVC environment, it is primarily a MV UI where the Controller is JavaScript based operating from the user's browser. Lightning "Pages" are single page applications.

42
votes
2answers
25k views

What are the available $A JavaScript functions in Lightning?

The Lightning Components Cheat Sheet lists a few common $A functions and the Lightning Components Developer Guide references some others that are useful for certain situations. I can view the $A ...
38
votes
2answers
4k views

Lightning Experience: How to prevent the display of obsolete data?

In many cases I've seen that LE is not displaying recent changes made in Setup immediately like in Salesforce Classic, but somehow cached or delayed. Yesterday I found an easy and perfectly ...
36
votes
2answers
10k views

What is suggested approach to transfer VF pages to be lightning ready

So I am planning to transfer our current VF pages to lightning ready. Most of our VF pages are based on a standard controller or standard set controller and use an extension. And they are pretty much ...
28
votes
3answers
5k views

How to build custom UI that works both for users that have opted in to Lightning Experience and users that have not?

This isn't a question about the pros/cons of Lightning/Visualforce, but is a question about how to build custom UI for the period of time (a year or many years?) where some users/orgs have Lightning ...
25
votes
1answer
2k views

Lightning experience page rendering is slow

I've developed a lightning component(actually about 4 sub-lightning components all included on a main component) that queries for records, displays them to a user, and has a form for contact ...
22
votes
3answers
4k views

Get file from Lightning input type file

With the Spring 17 release one of the new change on the markup is the introduction of the type file to the lightning:input, however I can't seem to get the file back, only a fakepath with the name of ...
21
votes
1answer
2k views

When to use {#v.attrib} vs {!v.attrib}?

I have seen some uses of {#v.attrib} in a few of lightning components, and I'm a person who is used to {!v.attrib}. Is there a difference between them or is there a scenario where '#' has to be used/...
21
votes
2answers
1k views

Do promises work in Lightning?

I wrote some code that uses promises. It seems that in the Promise environment, I can queue an action, and the action callback is never called. In the callback environment, when I queue an action, ...
19
votes
2answers
4k views

How to navigate in lightning out?

Actually I am using lightning components with a visualforce page, because this is the only way to override standard button (using VF) today. The problem is that, i need to redirect my user to the new ...
18
votes
2answers
3k views

Lightning Components in Visualforce - Unable to read sobject

I've started seeing this error since the Spring 16 release when I retrieve an sobject from the Apex controller, update it and then send it back to the server. I originally thought this was down to a $...
18
votes
3answers
953 views

force:navigateToComponent not loading component in Summer '17 | DOM repetition issue in Summer '17

I'm using force:navigateToComponent to navigate to a different component on click. On the first click, it navigates to the component and everything is successfully loaded. When pressing back button ...
17
votes
2answers
4k views

Infinite Loop Caused by Controller Action in Lightning Component

the following code is causing an infinite loop in my lightning component when I click the ui:button. Checking debug logs, nothing ever goes to the apex controller. .cmp layout <aura:attribute ...
17
votes
1answer
482 views

What can cause $A.createComponents to be slow?

Simple to ask, possible hard to answer. I have written a Lightning app to create forms which works a bit like the page builder in LEX itself. It saves the form description into JSON, and then ...
16
votes
3answers
938 views

What are the outer parentheses in Lightning controllers?

In every Lightning controller you have these outer parentheses wrapping the actual object: ({ getInput : function(cmp, evt) { var myName = cmp.find("name").get("v.value"); var ...
16
votes
2answers
13k views

Lightning App - getting URL parameter

We are planning to convert some of our VF pages to Lightning apps. Some our VF pages, particularly surveys are URL parameter-driven, since we send survey links directly to users, i.e. https://[...
16
votes
2answers
882 views

Sharing JavaScript between multiple Lightning Components

In a Lightning Component we have the notion of a JavaScript controller and a helper. We can use the helper to call code from the JavaScript controller that is shared between functions, so we can ...
16
votes
1answer
770 views

jQuery DOM manipulation performance in Lightning is awful with LockerService enabled

In a Lightning app that I am building, there is a reasonably large table (has 7 rows for each contact we are dealing with, there can easily be 40+ contacts that we are showing data from). Most of the ...
15
votes
2answers
7k views

Getting Session ID in Lightning

Background I'm using Apex Wrapper Salesforce Metadata API to update some picklist values on the fly. (i.e. Every time a record is inserted/updated/deleted in Table A, I'm adding/subtracting picklist ...
15
votes
3answers
465 views

How to send wrapped generic SObjects from Lightning to Apex

I have a lightning component with an apex controller that wraps generic records in an inner class. When I send the wrapped records to apex and receive them as generic SObjects, I get this error ...
15
votes
1answer
3k views

Forcing a refresh in force:recordData

force:recordPreview had a ignoreExistingAction attribute that would force a server trip. I have an issue right now where I have two components: Comp A - Contains a list of sObjects, saves/updates ...
15
votes
3answers
12k views

Salesforce lightning get current users username

How I would go about getting the current users username or first and last name? I have been looking at this for the last couple of hours - I was just wondering how I would go about getting their name ...
15
votes
1answer
6k views

$A.util.isEmpty() returns true on non-empty proxies

In Lightning, I've got into the habit of using $A.util.isEmpty() instead of testing for null, undefined, and empty Array. That seemed to be a good thing, but I've come across one situation where it ...
15
votes
3answers
428 views

How to access map or object elements dynamically in Lightning?

In VisualForce we could access dynamically to map elements using syntax {!map[mapIndex]} In Lightning if we try to define a map and use this syntax we would receive an error saying Failed to ...
14
votes
2answers
477 views

Map<String, Object> in AuraEnabled now failing in Spring 19 with “Value provided is invalid for action parameter”

Seems Spring 19 wants stricter typing for aura attributes, but I'm not finding any best practices on how to approach this. This use to work in Winter 19: MainController.js let myData = { parentId:...
13
votes
2answers
11k views

Component events vs Application events (component.getEvent vs $A.get)

I am new to lightning experience and components. I have been through some blogs and code that guide through the basics, but other than that I haven't had much hands-on experience. My question is: ...
13
votes
1answer
6k views

Problem with lightning:input component. Onchange event

I am trying to use "lightning:input" components (still in beta) but I encounter an issue when the component is firing the onchange event : Something has gone wrong. Underlying raw object [object ...
13
votes
1answer
820 views

Moment JS format returns function string in Lightning Spring 17

I use momentjs's library in my lightning application to manipulate javascript dates. When my sandbox was updated from winter 17 to spring 17 I noticed the format function doesn't work any more. ...
13
votes
2answers
460 views

Why would I use lntg:selectSObject?

The Lightning Component Developer Guide reference includes the event lntg:selectSObject. Per the docs, this event: Sends the recordId of an object when it’s selected in the UI. However, the sample ...
13
votes
1answer
360 views

component.find({ instancesOf : “lightning:input”}) return empty list in Summer '18

With new Summer '18 release following code returns empty list: component.find("social-security-number-form").find({instancesOf : "lightning:input"}) "social-security-number-form" is an aura:id of ...
13
votes
3answers
2k views

Dynamic Component Creation using “force:inputField”

@SkipSauls wrote an amazing article on how to use FieldSets in Lightning Components. Thank you! Link here But it seems like, using this approach, we can only use OOTB aura components (ui:textbox, ui:...
13
votes
0answers
306 views

Cannot read property '$$OwnerKey$$' of null

I have a Visualforce Lightning Out page that's rendering some <lightning:input type="date"> elements. Since the Winter '19 release in the dev sandbox I'm working in, whenever I select a date ...
12
votes
4answers
8k views

Winter 17 release : event.getSource is not a function on lightning:button

I'm trying to get the label of the button the user has clicked on by using event.getSource, but I'm getting the error that event.getSource is not a function. Component <lightning:button variant="...
12
votes
2answers
3k views

How do I call functions loaded from a Static Resource JavaScript file?

I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file ...
12
votes
4answers
6k views

Render fullcalendar on a lightning component

I have a lightning component that pulls data from Salesforce and adds them as events on a calendar created using fullcalendar. The component helper contains the method fetching the data from Server. ...
12
votes
2answers
1k views

“Limit expression must be of type Integer” error when using Apex variable in SOQL

I'm building a simple Lightning Component that pulls in a set amount of accounts and displays them. However, I keep getting a Limit expression must be of type Integer error message. I've hard-coded a ...
12
votes
1answer
3k views

Lightning : Show Stencil When Component Loads

So I see in the docs for SLDS they talk about using "Stencils" while a page loads. I can't find any examples of how they're implemented. Can anyone point me to any docs or samples that use this?
12
votes
1answer
117 views

Value provided is invalid for action parameter [VAR] of type 'String'" instead

Seems like upcoming changes in Spring 19 are causing us issues with "AuraEnabled" methods. Since forever now, primitive types were sent from Aura to APEX as String only as explained here: https://...
12
votes
2answers
990 views

What is aura.redirect?

I'm looking at one of the custom login controllers for communities and noticed this: @AuraEnabled public static String login(String username, String password, String startUrl) { try{ ...
12
votes
1answer
3k views

How do you build inline edit behavior when coding a lightning component?

How do you do this in code? With Visualforce, I had used apex:inlineEditSupport and I was wondering if there was the equivalent when building with lightning. Are there some out of the box components ...
12
votes
1answer
1k views

How to get ip address of current user in Lightning component

We are converting our visualforce pages to Lightning component. We were getting the ip address of the current user from visualforce page standard headers. But we cant use the same in Lightning ...
11
votes
4answers
19k views

Getting the URL parameter into Lightning component using the “{! paramName}” expression

I am new to communities in lightning and I am trying to figure out a way to directly fetch the URL parameters into the lightning component attributes using the {! urlParamName} expressions. for ...
11
votes
1answer
3k views

AuraClientService.postProcess: error in processing [RangeError: Maximum call stack size exceeded] - Client Side Action

I have a lightning component that is using ui:inputSelect. The component code: <div class="slds-form-element__control"> <ui:inputSelect class="slds-select" aura:...
11
votes
2answers
991 views

Salesforce Lightning Ready certification

Could you please provide main steps of "lightning ready" certification? Which checks application should be involved in before "lightning ready" certification? We have an application with several ...
11
votes
3answers
4k views

Lightning QuickAction (API) without modal

I am attempting to replace JS buttons with quick actions. These button simply call a web service method and alert the result and need no user interaction. With quick action a modal always seems to ...
11
votes
1answer
307 views

Create DX scratch org with caching disabled

One of the most useful tips I've come across when developing lightning components in Salesforce is to disable caching, as otherwise Salesforce tends to aggressively cache components which makes ...
11
votes
1answer
1k views

Are Lightning Interfaces (e.g. implements=“c:MyInterface”) actually useful for anything?

I've been trying to build a Lightning Community where I use component inheritance and interfaces to share certain bits of functionality. For my particular use, composition wouldn't fit as well as ...
11
votes
3answers
1k views

Lightning container : index.html not in the right folder

I try to use the lightning container to display an element in a salesforce component. So, I have this code : <aura:component access="global"> <lightning:container aura:id="timeline" ...
11
votes
1answer
426 views

Why DuplicateRecordItem is working only after INSERT and not after UPDATE of the dupe-record?

One key requirement of good Data Quality is a good duplicate prevention and merge process. Salesforce has introduced very powerful mechanisms like Duplicate and Matching-Rules for all SObjects. ...
11
votes
1answer
624 views

Calling Apex from Lightning returning a class extending an Abstract class

I have found an issue that when calling an Apex method from Lightning that returns a class that extends an abstract class, then only the @AuraEnabled getters from the concrete class are returned, the ...
11
votes
1answer
720 views

Move CSS Popover with cursor in Lightning

I'm trying to move a popover created with CSS, relative to the cursor position. I believe I could do this if I had access to the full DOM, but as far as I understand the LockerService prevents this. ...