I have a lightning component were it used at two places once at Quick action button in popup and other in record detail page layout. Know i would need to recognise when the component is opened in popup through the Quick action button, so that i need to perform required action within the component.

Any help is appreciated.

  • Wouldnt be the init event enough for you? . Check this (developer.salesforce.com/docs/atlas.en-us.lightning.meta/…) Apr 16, 2018 at 9:00
  • There are any parameters in init method to identify the component is fired from Quick action button as source?
    – Vivek P
    Apr 16, 2018 at 9:08
  • Ooookay, I didnt get your point. So, what you want to do is identifying 'who' fired the component initialization, whether the Quick Action or anything else, am I right? Apr 16, 2018 at 9:15
  • Yes, exactly i was looking for.
    – Vivek P
    Apr 16, 2018 at 9:38
  • @VivekP have you found any solution?
    – Venky
    Sep 25, 2018 at 16:07

3 Answers 3


You Can create an attribute in your Main component as

<aura:attribute name="source" type="String" default="detail" />

There is no way you can set an attribute from Quick Action while calling component directly. You can use an intermediate component though. While calling the Main component from Intermediate component, you can set the Source value as "QuickAction".

from Quick Action --> Call Intermediate component----> Intermediate Component calls main component.

  • Hi Bhawna, in order to set the attribute value, first i need to identify from which source intermediate component is triggered.
    – Vivek P
    Apr 17, 2018 at 1:09
  • In record detail page, Directly call the Main Component. Hence when the main component launches it would launch with default attribute source as "detail". But Through Quick Action, you will be invoking main component through Intermediate Component which will be passing source attribute values as "Quick Action". You can have an an if-else on Main Component now. <c:MainComponent source="QuickAction" />
    – Bhawna
    Apr 17, 2018 at 7:43

You can include an attribute like this one:

<aura:attribute name="origin" type="String" access="public" />

That way you can manage 'who' is calling your component, by filling this attribute in the quick action configuration.

Edit: To make your attribute accesible for a flexipage, you also need to create the design document

<design:component >
    <design:attribute name="origin" label="origin" /> 
  • I don't see any were can configure this attribute on Quick action or page layout embedded.
    – Vivek P
    Apr 16, 2018 at 10:26
  • You need to have created the design document to expose the component attributes. For example, the following attribute <aura:attribute name="Origin" type="String" access="public"/> is exposed once the design document has this <design:component > <design:attribute name="Origin" label="Origin" /> </design:component>. You can se more in the following link: developer.salesforce.com/docs/atlas.en-us.lightning.meta/… Apr 16, 2018 at 10:46
  • @RicardoPereira we cannot set attribute from quick action even if design attribute is defined Apr 16, 2018 at 18:52
  • But you can set it in the flexipage, and assumen that, when it is not coming from a flexipage, it is coming from a Quick Action. Doesnt that work for you? Apr 17, 2018 at 7:23
var origin= event.getSource();

on the init call from flexi page it will be SecureComponentRef: markup://flexipage:runtimeComponent and from quick action it will be SecureComponentRef: markup://forceChatter:lightningComponent.

It is helpful enough to find from where the component is being called.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .