5

i want to call lightning component with parameter in salesforce1 using custom button or link. How can i achieve this ?

  • 2
    Have you tried something or searched the documentation ? Without knowing what you've tried and where you're stuck at this is a broad question which doesn't show any effort from your own side. – Samuel De Rycke Feb 20 '15 at 8:45
  • Given the beta status of Lightning Components, I think there should be some lee way for this question. The answer is, custom buttons and links can't be made to invoke a lightning component right now. I would think we should state that as an answer. – pchittum Feb 23 '15 at 9:36
  • @Peter I've reopend the question. – Samuel De Rycke Feb 23 '15 at 10:17
4

As of the beta release in Spring 15, the following are the only ways to use custom lightning components in the Salesforce1 Mobile Application.

  • A custom tab of type Lightning Component
  • A custom tab of type Lightning App which has a set of lightning components on it

The first is well documented in the Lightning Component Developer guide.

The second will be beta soon, and you should follow progress on the success community group for Lightning App Builder.

Lightning components are not callable by URL, in fact. They are invoked events registered in the Lightning Component Framework.

This is, in fact, how you invoke standard lightning components.

Let's say I wanted to make the toast notification pop-down in my custom Lightning UI, I would do something like this:

            var showToast = $A.get('e.force:showToast');
            showToast.setParams(
                {
                    'title': 'Save Attachment'
                    'message': ': SUCCESS'
                }
            );
            showToast.fire();

When this kicks off, ostensibly when something else was successful, the event here fires, gets the lightning component for the toast feature, and makes it appear and animate, etc.

I suspect that when Lightning reaches more maturity there will be some analog to the custom-button-or-link-to-Visualforce feature we all know and love today, but it will have to follow the constructs of lightning components which use events, it suspect strongly it will not follow the Visualforce construct of request-a-URL.

  • Thanks @Peter for your reply. Your information clear so many things. I want to ask one question, can we move from one component to other component using lightning ? like there is opportunity and other is opportunity deal. I have create one component which show all opportunity list. there is one button namely " View Deal ", after clicking on that button, i want to show deal details. i have done this logic using "e.force:navigateToRelatedList". I want to do it using lightning. is there any way to do this ? – Nitish Feb 24 '15 at 10:48
  • So first of all e.force:navigateToRelateList is a lightning event. The whole Salesforce1 UI is Lightning Components. So the smug, unhelpful answer to "is there any way to do this?" is, "you already have." But I suspect that what you're after is more along the lines of this question here: salesforce.stackexchange.com/questions/56256/… – pchittum Feb 24 '15 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.