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
Navin SelvarajNavin Selvaraj 

How to display events in Site.com

I have created list of events in different dates. After the creation of the Events, I need to display those events in the site.com VF Page. But, when I was trying to show the account details, It is working fine. But, when I was trying to display the events. the events are not displaying in the site VF Page.

I need help for you to solve this issue.

Here I will put my code.


Controller Class:
public with sharing class EventController {
    private Datetime eventStartDateTime {get; set;}
    private Datetime eventEndDateTime {get; set;}
    private Datetime agentStartDateTime {get; set;}
    private DateTime agentEndDateTime {get; set;}
    private List<Event> listOfEvents {get; set;}

    public EventController(){ 
    }
    
   public List<Event> getListOfEvents(){
         listOfEvents = [SELECT  OwnerId, CreatedById, ActivityDate, StartDateTime, EndDateTime, Location FROM EVENT];
        return listOfEvents;
    }


VF Page Code:

<apex:page Controller="EventController">
    <apex:form >
   <apex:pageBlock title="Events Block">
       
      <apex:pageBlockTable value="{!listOfEvents}" var="event" id="table">
          <apex:column headerValue="Activity Id" value="{!event.Id}"/>
          <apex:column headerValue="Assigned To" value="{!event.OwnerId}"/>
          <apex:column headerValue="Created By" value="{!event.CreatedById}"/>
          <apex:column headerValue="Activity Date" value="{!event.ActivityDate}"/>
          <apex:column headerValue="StartDateTime" value="{!event.StartDateTime}"/>
          <apex:column headerValue="EndDateTime" value="{!event.EndDateTime}"/>
          <apex:column headerValue="Location" value="{!event.Location}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
    </apex:form>
</apex:page>

Manoj DegaManoj Dega
Hi Navin,

We cannot expose events in force.com sites, that is force.com site limitation. Fot that you can create some other object to route those events information and expose from over there. but if implement like this in future you can get DataLimit exceed issue for Organisation.
Navin SelvarajNavin Selvaraj
Thank you Manoj Dega
vijay jillella 9vijay jillella 9
daer Manoj,please help me withthe below
My concern is while i am generating an invoice and returning page i am able to see the invoice number in the page and when i am attaching it invoice number is missing.
here is the code
public SpecialInvoicesGST_vijay(){
//wrapObj = new list<ContactWrapper>();
appointment1 = new SCSCHAMPS__Appointment__c();
appde= new SCSCHAMPS__Appointment__c();
invBill=new Invoice__c();
invfp = new Invoice__c();//
totall = 0;
contactList  = new List<ContactWrapper>();
// cb=false;
// flag='false';
 AppList = new List<AppWrap>();//
 addMore();//
 selectedRowIndex = '0';//
 System.debug('rrrrrr'+val);
 inv = [SELECT id,Name,Invoice_Date__c  FROM Invoice__c ORDER BY Name DESC LIMIT 1]; //
  String s1= inv.Name;//
   invNo = Long.valueOf( s1.substring(3));//
  system.debug('&&invNo&&'+invNo);
}  
public void attachPdfToAccount(String  invBillCalendar, String appointmentEmployer, id invId){
     
Billing_Calendar__c bc=new Billing_Calendar__c(); 
bc=[select id,Name, Invoicing_Start_Date__c,Invoicing_End_Date__c from Billing_Calendar__c where Billing_Calendar__c.id=:invBillCalendar limit 1];            
Account acc = [select id,Name from Account where ID=:appointmentEmployer];    
if(ep=='None'&& desp==null)
{this.ep=desp;}
else{this.ep=ep;}
finalAcc = getAcc();
pagereference ref1;

//=================================main part to work===================================================//
   
Attachment myAttach1 = new Attachment();
flag = 'attach';
myAttach1.ParentId = invid;
inm3= [SELECT id,Name,invoiceNamecopy__C,invcopyno__C,Invoice_Date__c  FROM Invoice__c Where Id =: invId];
//myAttach1.name =bc.Invoicing_Start_Date__c+'To'+bc.Invoicing_End_Date__c +'.pdf';
myAttach1.name =inm3.name+'.pdf';
    
//myAttach1.body= ref.getContentAsPdf();

//myattach1.Id=inm1.id;
                       
if(appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirW')
{
//ref=page.Tesco_Special_Invoice_GST1;
   // ref=page.Tesco_Invoice;
     ref1=page.Tesco_Special_Invoice_GST_vijay;
}
else if(appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirY') 
{
//ref=page.Wipro_Special_Invoice_GST;
ref1=page.Wipro_Special_Invoice_GST_vijay;
system.debug('wipro special invoice');
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJira') )
{
//ref=page.IBM_Special_Invoice_GST1;
ref1=page.IBM_Special_Invoice_GST1_vijay; 
}
else if (appointment1.SCSCHAMPS__Employer__c=='0010k00000T2XXC')
{
ref1=page.testspecial;
}
/*else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirY') && (toi=='Allowances'))
{
ref=page.Wipro_Invoice_Allowances;
 }*/
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPRC')
{

ref1=page.First_American_Special_Invoice_GST;

}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirS')
{
//ref=page.SAP_Labs_Special_Invoice_GST;
ref1=page.SAP_Labs_Special_Invoice_GST_vijay;
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPLG')
{
//ref=page.BNP_SIGST_Production;
ref1=page.BNP_SIGST_Production_vijay;    
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPKh')
{
//ref=page.Amdocs_Special_Invoice_GST;
ref1=page.Amdocs_Special_Invoice_GST_vijay;
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirU')
{
//ref=page.True_Blue_Special_Invoice_GST;
    ref1=page.True_Blue_Special_Invoice_GST_vijay;
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPSe') )
{
//ref=page.GenpactSpecialInvoiceGST;
ref1=page.GenpactSpecialInvoiceGST_vijay;             
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001sbvvM') )
{
//ref=page.Special_Invoice_GSTAccenture_updated;  
ref1=page.Special_Invoice_GSTAccenture_vijay;           
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001yyxQS') )
{
//ref=page.Experis_IT_Special_invoice;   
ref1=page.Experis_IT_Special_invoice_vijay;          
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00002Ca81c') )
{
//ref=page.SAP_Premium_special_invoice_GST; 
 ref1=page.SAP_Premium_special_invoice_GST_vijay;             
}
else
{
ref1 = page.Consolidated_Special_Invoice_GST;
}
          
                
ref1.getParameters().put('inm3.name',inm3.name);

               
ref1.getParameters().put('accId',invId);
ref1.getParameters().put('flag1',String.valueOf(flag));
ref1.getParameters().put('ep1',ep);
ref1.getParameters().put('toi1',toi);
ref1.getParameters().put('stax1',stax);
ref1.getParameters().put('scurr1',scurr);
ref1.getParameters().put('pos',pos);
ref1.getParameters().put('sop1',sop);
ref1.getParameters().put('ids',strids);
                
                //GST Implementation
ref1.getParameters().put('taxa1',taxa);
ref1.getParameters().put('addG1',addG);
ref1.getParameters().put('gst1',gst);
            
ref1.getParameters().put('startDate',string.valueOf(bc.Invoicing_Start_Date__c));
ref1.getParameters().put('endDate',string.valueOf(bc.Invoicing_End_Date__c));
             
if(edate!=null)
ref1.getParameters().put('edt',string.valueOf(edate));
else 
ref1.getParameters().put('edt',string.valueOf(Date.Today())); 
if(bdate!=null)
ref1.getParameters().put('bdt',string.valueOf(bdate));
else 
ref1.getParameters().put('bdt',string.valueOf(Date.Today())); 
//ref1.getParameters().put('','print');  
   // ref1.getParameters().put('flag1','print');  
 myAttach1.body = ref1.getContentAsPdf();    
insert myAttach1;
attach();
}


vf page:
<apex:page Controller="SpecialInvoicesGST_vijay"  showHeader="false"  applyHtmlTag="false" renderAs="pdf" applyBodyTag="false" >
<html style="margin-top: 0px;font-size:10px;page-break-inside:avoid">
<head>
<style type="text/css" media="print">
@page {
 margin-top: 35mm;
  margin-bottom: 15mm;
@top-center {
content: element(header);
}
@bottom-left {
 content: element(footer);
}
}
</style>
</head>
 
<div class="header">
<div></div>
</div>
 
<div class="footer">
<div></div>
</div>
<body>
<div class="content">        
<table width="100%" cellspacing="0" cellpading="0" border="1" style="font-size:10px;page-break-inside:avoid" >
<tr><th colspan="9" bgcolor="#D3D3D3" align="center" ><h><span style="font-size:13px"><B>INVOICE---{!record.name}</B><br/> </span></h></th></tr>
<tr><apex:panelGroup rendered="{!taxa!='GST'}"><td height="50%" colspan="4"><h>To</h><br/><br/>
{!acc.BillingStreet}<br/>{!acc.BillingCity}<br/>{!acc.BillingState}&nbsp;{!acc.BillingPostalCode}<br/>{!acc.BillingCountry}&nbsp;{!acc.BillingLatitude}&nbsp;{!acc.BillingLongitude}                   

    </td>
</apex:panelGroup>
<apex:panelGroup rendered="{!taxa=='GST'}">
<td height="50%" colspan="4" style="display:{!if(addG=='GST1','','none')}" >To,
<br/>{!acc.GST1_Address__c}
<br/>{!acc.GST1_Street__c}
<br/>{!acc.GST1_City__c}
<br/>{!acc.GST1_State_Province__c}
<br/>{!acc.GST1_Zip_Postal_Code__c}
<br/>{!acc.GST1_Country__c}
<br/>GSTIN - {!acc.Client_GST1_Number__c}

</td>
<td height="50%" colspan="4" style="display:{!if(addG=='GST2','','none')}">To,
<br/>{!acc.GST2_Address__c}
<br/>{!acc.GST2_Street__c}
<br/>{!acc.GST2_City__c}
<br/>{!acc.GST2_State_Province__c}
<br/>{!acc.GST2_Zip_Postal_Code__c}
<br/>{!acc.GST2_Country__c}
<br/>GSTIN - {!acc.Client_GST2_Number__c}
</td>
<td height="50%" colspan="4" style="display:{!if(addG=='GST3','','none')}">To,
<br/>{!acc.GST3_Address__c}
<br/>{!acc.GST3_Street__c}
<br/>{!acc.GST3_City__c}
<br/>{!acc.GST3_State_Province__c}
<br/>{!acc.GST3_Zip_Postal_Code__c}
<br/>{!acc.GST3_Country__c}
<br/>GSTIN - {!acc.Client_GST3_Number__c}
</td>
</apex:panelGroup>
    
    <td height="50%" colspan="5">
<apex:variable value="{!Inm3.name}" var="inm"/> 


<apex:panelGroup >    
<h align="right" style="display:{!if(flag=='attach','{!inm}','{!inm}')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;11===={!record.name}<br/></h> 
<h align="right" style="display:{!if(flag=='false','','{!inm}')}">  
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;21===={!inm}<br/></h>
<h align="right" style="display:{!if(flag=='print','','none')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;31===={!inm1}<br/></h>
<h align="right" style="display:{!if(flag=='view','','none')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;41===={!inm1}<br/></h>
</apex:panelGroup>
  <apex:pageBlock>
      <apex:pageBlockTable value="{!record}" var="a">
          <apex:column value="{!record.name}" title="iiiiiiiiiiiii"/>
      
      </apex:pageBlockTable>
        
        </apex:pageBlock>