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
SFDC12SFDC12 

Lightning scenario

Hi everyone ,using aura component how to display the modal popup on the contact record whose name starts with test.

Thanks in advance
SwethaSwetha (Salesforce Developers) 
HI Anusha,
The code mentioned in https://developer.salesforce.com/forums/?id=9060G0000005nfOQAQ should help you get started.

If this information helps, please mark the answer as best. Thank you
mukesh guptamukesh gupta

Hi Anshi,

first you need to create a Ligtning component that will use SQOL and fetach contact with test 

Select id,name from contact where name Like 'Test%'

Use below code in Ligtning compoent and Add this component in bottom side of contact record page.

Component
<aura:component controller="ContactDetail" implements='force:hasRecordId'>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>



<!--use boolean attribute for Store true/false value,
    make default to "false" so modal box are not display on the load of component. 
    --> 
    <aura:attribute name="isOpen" type="boolean" default="false"/>
    
    <!--Use "slds-m-around_xx-large" class to add standard X-Large padding to the component--> 
    <div class="slds-m-around_xx-large">
        
        <lightning:button variant="brand"
                          label="Contact"
                          title="Contact"
                          onclick="{! c.openModel }" />
        <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
        <aura:if isTrue="{!v.isOpen}">
            
            <!--###### MODAL BOX Start######--> 
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container">
                    <!-- ###### MODAL BOX HEADER Start ######-->
                    <header class="slds-modal__header">
                        <lightning:buttonIcon iconName="utility:close"
                                              onclick="{! c.closeModel }"
                                              alternativeText="close"
                                              variant="bare-inverse"
                                              class="slds-modal__close"/>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">About Sfdcmonkey.com</h2>
                    </header>
                    <!--###### MODAL BOX BODY Part Start######-->
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <p><b>
 ADD YOUR DETAIL HERE
                            </b>
                        </p>
                    </div>
                    <!--###### MODAL BOX FOOTER Part Start ######-->
                    <footer class="slds-modal__footer">
                        <lightning:button variant="neutral" 
                                          label="Cancel"
                                          title="Cancel"
                                          onclick="{! c.closeModel }"/>
                        <lightning:button variant="brand" 
                                          label="Like and Close"
                                          title="Like and Close"
                                          onclick="{! c.likenClose }"/>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
            <!--###### MODAL BOX Part END Here ######-->
            
        </aura:if>
    </div>

</aura:component>

COntroller
({
init: function(cmp,event,helper) {
  
 var action = component.get("c.serverEcho");
        action.setParams({
                  conId:component.get("v.recordId")
                        });

  action.setCallback(this, function(response) {
            var state = response.getState();
           
            if (state === "SUCCESS") {
              
             component.set("v.isOpen", true);
           }
        
            else if (state === "INCOMPLETE") {
               
            }
          
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        $A.enqueueAction(action);
    }
})

Apex:- ContactDetail
public class ContactDetail{
    
    @AuraEnabled
    public static boolean getContact(ID conId) {
        boolean  isContactWithTest = false; 
        Contact contactResult = [Select Name from Contact where id =:conId AND name like 'Test%'];
        if(contactResult != null){
          isContactWithTest =  true;
          }
              
        return isContactWithTest;
    }
}

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh 
Suraj Tripathi 47Suraj Tripathi 47

Hi,

You can make modal from below link:

https://sfdcmonkey.com/2017/04/15/modal-box-lightning-component-salesforce/

Thank You

Mukesh Kumar 470Mukesh Kumar 470
 create a LWC component to show EmailStatus.

There is an object named as email status show that in LWC

help me please
 
ravi soniravi soni
hi ,
try below Aura Component when user click a Record which name start with Test then a modal popup will be displayed on recordPage but you have to add this component on ContactDetailPage.
 
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="ContactDetailCtrl">
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>



<!--use boolean attribute for Store true/false value,
    make default to "false" so modal box are not display on the load of component. 
    --> 
    <aura:attribute name="isOpen" type="boolean" default="false"/>
    
    <!--Use "slds-m-around_xx-large" class to add standard X-Large padding to the component--> 
    <div class="slds-m-around_xx-large">
        
        <!--<lightning:button variant="brand"
                          label="Contact"
                          title="Contact"
                          onclick="{! c.openModel }" />-->
        <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
        <aura:if isTrue="{!v.isOpen}">
            
            <!--###### MODAL BOX Start######--> 
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container">
                    <!-- ###### MODAL BOX HEADER Start ######-->
                    <header class="slds-modal__header">
                        <lightning:buttonIcon iconName="utility:close"
                                              onclick="{! c.closeModel }"
                                              alternativeText="close"
                                              variant="bare-inverse"
                                              class="slds-modal__close"/>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">This is your Header</h2>
                    </header>
                    <!--###### MODAL BOX BODY Part Start######-->
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <p><b>
 Hello, This is your Test Contact Record page
                            </b>
                        </p>
                    </div>
                    <!--###### MODAL BOX FOOTER Part Start ######-->
                    <footer class="slds-modal__footer">
                        <lightning:button variant="neutral" 
                                          label="Cancel"
                                          title="Cancel"
                                          onclick="{! c.closeModel }"/>
                        <lightning:button variant="brand" 
                                          label="Save"
                                          title="Save"
                                          onclick="{! c.closeModel }"/>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
            <!--###### MODAL BOX Part END Here ######-->
            
        </aura:if>
    </div>
</aura:component>
 
({
	
doInit: function(component,event,helper) {
  
 var action = component.get("c.getContact");
        action.setParams({
                  conId:component.get("v.recordId")
                        });

  action.setCallback(this, function(response) {
            var state = response.getState();
           
            if (state === "SUCCESS") {
              
             component.set("v.isOpen", response.getReturnValue());
           }
        
            else if (state === "INCOMPLETE") {
               
            }
          
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        $A.enqueueAction(action);
    },
    
    closeModel :  function(component,event,helper) {
        component.set("v.isOpen", false);
    }

})
 
public class ContactDetailCtrl {
    @AuraEnabled
    public static boolean getContact(string conId) {
        boolean  isContactWithTest = false; 
        for(Contact con : [Select Name from Contact where Id =:conId AND Name like 'Test%']){
             isContactWithTest =  true;
        }
        return isContactWithTest;
    }
}

don't forget to mark it as best answer if it helps you.
Thank you