-
Why selected contact not showing in EmailDetail page?
In my page after selecting sendEmail Button, My page is redirecting to EmailDetail page
But In EmailDetail page selected contact is not showing.
Here is code
<apex:page controller="SearchRecords" showHeader="false" sidebar="false" >
<apex:form id="frm">
<apex:pageblock >
<apex:pageBlockSection title="Search Account Records" columns="1">
Enter Name<apex:inputText value="{!getstring}" id="theTextInput"/>
<apex:commandButton action="{!searchRecord}" value="Search" id="theSearch" reRender="frm"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Account Detail" id="pb">
<apex:pageBlocktable value="{!accountlist}" var="acc">
<apex:column >
<input type="radio" name="group1" reRender="{!display}" />
<apex:actionSupport event="onclick" action="{!newClick}" reRender="conSection" >
<apex:param assignTo="{!AccId}" name="accname" value="{!acc.id}"/>
</apex:actionSupport>
</apex:column>
<apex:column value="{!acc.Name}"/>
<apex:column value="{!acc.Phone}"/>
</apex:pageBlocktable>
</apex:pageBlockSection><apex:outputPanel id="conSection">
<apex:pageBlockSection title="Related Contact" id="conpgblk" rendered="{!display}" >
<apex:outputPanel rendered="{!listWrapper.size != 0}">
<div align="center" >
<apex:commandButton value="Send Email" action="{!SendEmail}"/>
<apex:commandButton value="Print Detail" action="{!PrintDetail}"/>
</div>
<apex:pageBlockTable value="{!listWrapper}" id="pbt1" var="wrap">
<apex:column headerValue="Select">
<apex:inputCheckbox value="{!wrap.checked}" id="inputBox"/>
</apex:column>
<apex:column value="{!wrap.con.Name}"/>
<apex:column value="{!wrap.con.Phone}"/>
<apex:column value="{!wrap.con.Email}"/>
<apex:column value="{!wrap.con.Account.Name}"/>
<apex:column value="{!wrap.con.AccountId}"/>
<apex:column value="{!wrap.con.Id}"/>
</apex:pageBlockTable>
<apex:commandButton value="First Page" rerender="conpgblk" action="{!FirstPage}" disabled="{!prev}"/>
<apex:commandButton value="Previous" rerender="conpgblk" action="{!previous}" disabled="{!prev}"/>
<apex:commandButton value="Next" rerender="conpgblk" action="{!next}" disabled=""/>
<apex:commandButton value="Last Page" rerender="conpgblk" action="{!LastPage}" disabled="{!disable}"/>
</apex:outputPanel>
<apex:outputPanel rendered="{!listWrapper.size == 0}">
<b> NO RELATED CONTACTS FOR THIS ACCOUNT.</b>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>public class SearchRecords {
public boolean display{get;set;}
public boolean disable{get;set;}
public String AccId{get;set;}
public string getstring{get;set;}
public string selectedvalie{get;set;}
public List<Account> accountlist {get;set;}
public list<Contact> conList{get;set;}
public list<Attachment> AttachmentList{get;set;}
private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize=3;
public contact con{get;set;}
public Attachment Att{get;set;}
public string Body{get;set;}
public string Subject{get;set;}
public string selectAttachment{get;set;}
public boolean Attc{get;set;}
public boolean Docu{get;set;}
public boolean SysFil{get;set;}
public List<WrapperClass> listWrapper {get;set;}
public List<WrapperClass> listWrapper1 {get;set;}
public void searchRecord(){
display=False;
accountlist= new list<Account>();
if(getstring!=null){
accountlist= Database.query('select id,AccountNumber,name,Phone from Account where name like \'%'+getstring+'%\'');
}
}
public void newClick(){
disable=false;
LimitSize=3;
OffsetSize=0;
showContact();
}
public void showContact(){
display=true;
listWrapper = new List<WrapperClass>();
List<Contact> conlist =[SELECT id,Title,Fax,Birthdate,Name,Account.Name,Phone,Email FROM Contact WHERE AccountId=:AccId LIMIT :LimitSize OFFSET :OffsetSize];
if(conlist!=NULL){
totalRecs = conlist.size();
for(contact con:conlist)
{
listWrapper.add(new WrapperClass(con));
}
}
}
public pageReference PrintDetail(){
listWrapper1=new list<WrapperClass>();
for(WrapperClass wr: listWrapper){
if(wr.checked==true)
listWrapper1.add(wr);
}
pageReference acctPage = new pageReference('/Apex/printContactDetail');
return acctPage;
}public pageReference SendEmail(){
listWrapper1=new list<WrapperClass>();
String str='';
for(WrapperClass wr: listWrapper){
if(wr.checked==true){
listWrapper1.add(wr);
str+=wr.con.id+',';
}
system.debug('====>listWrapper1'+listWrapper1);
}
str=str.removeEnd(',');
pageReference EmailPage = new pageReference('/Apex/EmailDetail?id='+str);
emailPage.setRedirect(true);
return EmailPage;
}
public pageReference AddFile(){
String str=ApexPages.currentPage().getParameters().get('id');
PageReference acctPage = new pageReference('/Apex/AttachmentPage?id='+str);
return acctPage;
}
set<id> contactId=new set<Id>();public void Attachment(){
String str1=ApexPages.currentPage().getParameters().get('id');
system.debug('---line81'+str1);
for(string st:str1.split(',')){
contactid.add(st);
}
AttachmentList=[select Id,Name,Body,BodyLength,ContentType,ParentId from Attachment where ParentId IN:contactId];
system.debug('AttachmentList'+AttachmentList);
}
public void HideShow(){
system.debug('selectAttachment'+selectAttachment);
if(selectAttachment=='Attachment'){
Attc=True;
Docu=False;
SysFil=False;
Attachment();
}
else if(selectAttachment=='Document'){
Attc=False;
Docu=True;
SysFil=False;
}
else if(selectAttachment=='System File'){
Attc=False;
Docu=False;
SysFil=True;
}
}
public pageReference Send(){
return null;
}
public pageReference Cancel(){
return null;
}
public void FirstPage(){
disable=false;
OffsetSize = 0;
showContact();
}
public void previous(){
disable=false;
OffsetSize = OffsetSize - LimitSize;
showContact();
}
public void next(){
OffsetSize = OffsetSize + LimitSize;
showContact();
}
public void LastPage(){
disable=true;
OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
showContact();}
public boolean getprev(){
if(OffsetSize == 0)
return true;
else
return false;}
public boolean getnxt(){
if((OffsetSize + LimitSize) > totalRecs)
return true;
else
return false;
}public pageReference Save(){
return null;
}
public class WrapperClass {
public Boolean checked {get;set;}
public contact con {get;set;}
public WrapperClass(contact con) {
this.con=con;
checked=false;
}
}
}
EmailDetail page
<apex:page controller="SearchRecords" showHeader="false" sidebar="false">
<script>
function openPopup(){
window.open('/apex/AttachmentPage','mywindow','width=600,height=400');
}
</script>
<apex:form >
<apex:pageBlock title="Send Email To Selected Contacts">
<div align="Middle">
<apex:commandButton value="Send" action="{!Send}" />
<apex:commandButton value="Add File" onclick="openPopup();return false;"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</div>
<apex:pageBlockSection title="Email" columns="1">
<apex:repeat value="{!listWrapper1}" var="wrap">
To:<apex:outputfield value="{!wrap.con.Name}" />
</apex:repeat>
<div class = "requiredInput">
Subject<div class = "requiredBlock"></div>
<apex:inputText title="Subject" required="true"/>
</div>
<apex:inputtextarea label="Body" richtext="true" value="{!Body}" cols="50" rows="15"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Log In to reply.
Popular Salesforce Blogs
Benefits of Salesforce CRM For Startups
As a startup business, it can get challenging to have a strong first quarter once you begin operations. This is primarily due to the missed…
Salesforce Quoting Software: 9 Signs It’s Time to Consider a CPQ Solution
Are pricing errors or inconsistencies causing delays or customer dissatisfaction in your quoting process? Does generating a quote or proposal take too long due to…
Salesforce Automation with Workflow Rules
Following our previous article on Salesforce Automation Tools, this article covers automation using the Workflow tool in more detail. Workflows are suitable for a single if/then statement that…
Popular Salesforce Videos
How Salesforce AppExchange Can Boost Your Application's Marketing ?
Explore the key benefits of AppExchange, the largest business app marketplace, and discover how you can tap into its vast ecosystem of potential customers. In…
Data Migration - Salesforce Admin Tutorial
In this video, Zorial Salesforce Tech gives a quick k overview of how to migrate data using Salesforce. He goes over some key points to…
How To Start A Career In Salesforce? | Video Tutorial
Planning to start a career in Salesforce? Wondering where to head and learn. Watch this video and join this useful group for Salesforce job &…
Popular Salesforce Infographics
Why Salesforce End-user Training Matters for Smooth Implementation
This infographic 'Why Salesforce end-user training matters for smooth implementation' appeared first on Cynoteck. The progress of any CRM implementation depends on its general adoption…
What Is Mobile Marketing Automation?
Mobile use is booming, and it’s not slowing down anytime soon. In fact, research from eMarketer suggests that between 2015 and 2021, mobile-only internet users…
Salesforce Buzz | An Infographic
While Salesforce has been coined as the World's #1 CRM, there has been a constant buzz around the stats and facts of it. Almost 58%…