3

Basically, I've a requirement to execute Global/Quick Actions in Lightning Experience via a Custom Lightning Component that I have developed. In that component, I would like to button a custom Button that would execute the Global/Quick Action and the component would open up as a modal dialog on screen.

Can we do such a thing in Lightning?

  • Refer this, in case in helps developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – Santanu Boral Apr 20 '17 at 20:30
  • This would allow me to put the Lightning Component in Global Action. What I'm looking for is a way I can execute this component via a button in another Component and this Component will pop open in as a Modal Dialog without any page redirection (I do not want to loose context or record that is currently opened and from where the custom button would call this global action). I want to stress on Global Action, because Global Actions would open in Center of screen as a modal dialog automatically (without custom developed component would only be opened in Parent Container Lightning Component). – VarunC Apr 20 '17 at 20:46
  • @VarunC did you able to make this? Actually I am also looking to reuse the existing standard global actions for multiple purposes. pls let me know if you got any workaround except creating same functionality again. – Ysr Shk Oct 2 '17 at 18:47
  • No, none so far. – VarunC Oct 2 '17 at 20:11
  • @VarunC any luck on this? I really don't want to add modal code to my existing component. It seems like I am way overdoing it. – disasterlooms Mar 28 '18 at 18:29
0

ComponentA is your component on the page and ComponentB is the component used as a Global Action.

Are you saying you want ComponentA to open ComponentB as a global action just so that ComponentB displays as a modal in the middle of the screen? If that's the case, I would not recommend that approach. Take a look at the Modal component in SLDS: https://www.lightningdesignsystem.com/components/modals/

You can have a Lightning Component open a modal in the middle of the screen. Check out the PropertyMap and PictureGallery components in the DreamHouse sample app for an example.

However, if your use case is that the component on the page and the component used as a global action need to reuse shared functionality, then I would encapsulate the shared functionality in a separate component (ComponentC), and have both ComponentA and ComponentB use ComponentC as needed. ComponentA would instantiate it in a modal as described above (and as as illustrated in the PropertyMap and PictureGallery components in DreamHouse)

  • Thanks for the advice. I liked this approach, though it still only opens up inside the Tab Menu Bar. The normal Quick Action would utilize full browser window, and open modal dialog with backdrop preventing access to everything including Navigation Tab Menu as well. Is there anything more we could do? That is why I was looking for a way to just trigger an event or something that could initiate the Quick Action directly instead of us opening Lightning Component manually via injection in our code. – VarunC Apr 21 '17 at 9:19
  • @ChristopheCoenraets I created a quick action but do not want it to be on my top page because it is not quickly accessible (many buttons) but there is a page where it makes sense to make it a modal. Are you saying, it would be better to convert my quick action component to a modal? I would think this is a but over engineering, assuming there is a way to call the quick action from a custom button. – disasterlooms Mar 28 '18 at 18:27

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.