You need to sign in to do that
Don't have an account?
Subhojit Bhattacharjee 27
Need to send selected records to Email Template
Hi All,
My requirement is to send a list of selected events from a vf page to an email template.
At first, I have developed a wrapper class and gets to select some events. But I am stuck after that. I am trying to put the values in a custom component and from there I am thinking of putting into Email template (so that the selected values from vf page appears).
Could anyone help me.
Thanks,
SB
My requirement is to send a list of selected events from a vf page to an email template.
At first, I have developed a wrapper class and gets to select some events. But I am stuck after that. I am trying to put the values in a custom component and from there I am thinking of putting into Email template (so that the selected values from vf page appears).
Could anyone help me.
Thanks,
SB
<apex:page controller="WrapperCaseClass01" Tabstyle="Case">
<script>
function checkAll(cb)
{
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++)
{
if(inputElem[i].id.indexOf("checkedone")!=-1)
inputElem[i].checked = cb.checked;
}
}
</script>
<apex:form >
<apex:pageBlock title="Events">
<apex:pageBlockButtons >
<apex:commandButton value="Process" action="{!getSelected}">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_Ev"/>
</apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!events}" var="e" >
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_Ev"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!e.selected}" id="checkedone">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_Ev"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="Subject" value="{!e.eve.Subject}" />
<apex:column headerValue="Name" value="{!e.eve.Who.Name}" />
<apex:column headerValue="Start Time" value="{!e.eve.StartDateTime}" />
<apex:column headerValue="End Time" value="{!e.eve.EndDateTime}" />
<apex:column headerValue="Assigned To" value="{!e.eve.Owner.Name}" />
</apex:pageBlockTable>
<apex:pageBlockSection Title="Selected Events" id="Selected_Ev">
<apex:dataTable value="{!SelectedEvents}" var="e" columnswidth="400px,100px" cellpadding="10" border="1">
<apex:column headerValue="Subject" value="{!e.Subject}" />
<apex:column headerValue="Name" value="{!e.Who.Name}" />
<apex:column headerValue="Start Time" value="{!e.StartDateTime}" />
<apex:column headerValue="End Time" value="{!e.EndDateTime}" />
<apex:column headerValue="Assigned To" value="{!e.Owner.Name}" />
</apex:dataTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Wrapper Class
public class WrapperCaseClass01
{
public List<Event> selectedEvents = new List<Event>();
List<eventwrapper> EventList = new List<eventwrapper>();
public List<eventwrapper> getEvents()
{
for(Event e : [SELECT Subject, Who.Name, StartDateTime, EndDateTime, Owner.Name FROM Event limit 10]) {
EventList.add(new eventwrapper(e));
}
return EventList;
}
public pagereference getSelected()
{
selectedEvents.clear();
for(eventwrapper evewrapper : EventList) {
if(evewrapper.selected == true) {
selectedEvents.add(evewrapper.eve); }
}
system.debug('The list is:' + selectedEvents);
return null;
}
public List<Event> getSelectedEvents()
{
if(selectedEvents.size()>0) {
system.debug('>>>>>>>>>>>>>>>>>>>>'+selectedEvents);
return selectedEvents; }
else
return null;
}
public class eventwrapper
{
public Event eve{get; set;}
public Boolean selected {get; set;}
public eventwrapper(Event e)
{
eve = e;
selected = false;
}
}
}