function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tulasiram chtulasiram ch 

how to pass accountid to popup window for displaying related contactList in lightning

I used following component and controller with apex class: But i am knew to lightning, Please help me how to display related contactlist with accountid in new window...
DisplayAccountsWithContacts.cmp:
  1. <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
  2.    <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
  3.    <aura:attribute name="accounts" type="account[]"/>
  4.    <table>
  5.         <tr>
  6.             <td> Name </td>
  7.             <td> Industry </td>
  8.             <td> Phone</td>
  9.             <td> CreatedDate</td>
  10.             <td> ContactList Button</td>
  11.          </tr> <b/>
  12.          <aura:iteration items="{!v.accounts}" var="accs1" >
  13.                <tr>
  14.                 <td> {!accs1.Name} </td>
  15.                 <td> {!accs1.Industry} </td>
  16.                 <td> {!accs1.Phone} </td>
  17.                 <td> {!accs1.CreatedDate}</td>
  18.                 <td> <lightning:button variant="neutral" label="ContactList" onclick="{! c.handleClick }" /> 
  19.                    </td>
  20.                </tr><b/>
  21.          </aura:iteration>
  22.     </table>
  23.     <aura:attribute name="isOpen" type="boolean" default="false"/>
  24.          <div class="slds-m-around--xx-large">
  25.                 <aura:if isTrue="{!v.isOpen}">
  26.                  <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
  27.                     <div class="slds-modal__container">
  28.                   <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
  29.                       <div class="slds-modal__header">
  30.                     <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
  31.                     <span class="slds-assistive-text">Close</span>
  32.                     </button>
  33.                     <h2 id="header99" class="slds-text-heading--medium">ContactList</h2>
  34.                   <!--###### MODAL BOX FOOTER Part Start From Here ######-->
  35.                       <div class="slds-modal__footer">
  36.                         <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
  37.                         <button class="slds-button slds-button--brand" onclick="{!c.likenClose}">Like and Close</button>
  38.                       </div>
  39.                       </div>
  40.                             
  41.                     </div>
  42.                    </div>
  43.                 </aura:if>
  44.          </div>
  45. </aura:component>
DisplayAccountsWithContactsController.js:
  1. ({    
  2.     myAction : function(component, event, helper) {
  3.         var action =component.get("c.getAllAccounts");
  4.         console.log('The action value is: '+action);
  5.          action.setCallback(this, function(a){              
  6.             component.set("v.accounts", a.getReturnValue());
  7.            //  console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
  8.             console.log('The accs are :'+JSON.stringify(a.getReturnValue()));          
  9.         });
  10.         $A.enqueueAction(action);
  11.     },
  12.     handleClick : function(component, event, helper) { 
  13.         component.set("v.isOpen", true);   // for Hide/Close Model,set the "isOpen" attribute to "Fasle" 
  14.     }  , 
  15.       closeModel: function(component, event, helper) {
  16.          component.set("v.isOpen", false); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"        
  17.    },
  18.    likenClose: function(component, event, helper) {
  19.         alert('thanks for like Us :)');// Display alert message on the click on the "Like and Close" button from Model Footer 
  20.                                        // and set set the "isOpen" attribute to "False for close the model Box.
  21.         component.set("v.isOpen", false);
  22.    },
  23. })
accountswithContactsClass.apxc:
public class accountsWithContactsClass {
    @auraEnabled
public static list<account> getAllAccounts()
    {
     list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
     return accs;
    }
}
===================================================================================================
User-added image











 
Best Answer chosen by tulasiram ch
tulasiram chtulasiram ch
https://salesforce.stackexchange.com/questions/192584/not-able-to-display-related-contacts-in-lightning-modal-dialogue?noredirect=1#comment290820_192584

Solved...exactly what i wanted...

All Answers

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Tulasi ram,

May I suggest you please refer the below link for reference. Hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
tulasiram chtulasiram ch
Rahul, i wanted to open new popup with related contact list when he clicked on contact list button
associated with a particular account.
tulasiram chtulasiram ch
https://salesforce.stackexchange.com/questions/192584/not-able-to-display-related-contacts-in-lightning-modal-dialogue?noredirect=1#comment290820_192584

Solved...exactly what i wanted...
This was selected as the best answer
Raju Mushke 19Raju Mushke 19

HI tulasiram,

I have same senrio . but i am unbale to open that link(whate you provide best answer).

Could you please advice .