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
Salesforce2015Salesforce2015 

Create Report using Code

Hi Experts,

I need to create a report using coding.
Data from 4 different objects with lookup relationship, group by user depending on created date in last week (Sunday to Saturday).

Please find the below image for reference.

User-added image

If need any further information, please let me know.

Thanks,
Manu
Niket SFNiket SF
Here is small video http://salesforce.vidyard.com/watch/-8deIXAgRiNA7zJnyTr_3w

 
Salesforce2015Salesforce2015
Hi Niket,

Thanks for quick response. I don't want basics in creation of report.
Above image was taken form data of join report created by me.
But join report, not full fill my requirement.

Requirement:
First and Second objects need to show records count depending on created date group by user.
Third and Fourth objects need to show record details depending on created date group by user.

After completion of report, it should send as schedule report to particular users.
Salesforce2015Salesforce2015
Apex Class:


public class MyJobOrdersController
{

private List<ts2__Job__c> JobOrders;
public List<ts2__Job__c> getJobOrders()
{
JobOrders = [Select Id, Name, Customer__c, Contact__c, ts2__Status__c, ts2__Stage__c, State__c, City__c from ts2__Job__c limit 100];
return JobOrders;
}

private List<ts2__Application__c> Submissions;
public List<ts2__Application__c> getSubmissions()
{
Submissions = [select Id, Name, ts2__Candidate_Contact__c, ts2__Job__c, ts2__Status__c, ts2extams__SubStatus__c, ts2extams__overall_SubStatus_Link__c from ts2__Application__c limit 100];
return Submissions;
}

private List<ts2__Interview__c> Interviews;
public List<ts2__Interview__c> getInterviews()
{
Interviews = [select Id, Name, ts2__Job__c, ts2__Status__c, ts2extams__Substatus__c, ts2__Candidate__c, ts2__Candidate_Phone__c, ts2__Account__c, ts2__Contact__c from ts2__Interview__c limit 100];
return Interviews;
}

private List<ts2__Placement__c> Placements;
public List<ts2__Placement__c> getPlacements()
{
Placements = [select Id, Name, ts2__Job__c, ts2__Client__c, Invoice__c, Account_Name__c from ts2__Placement__c limit 100];
return Placements;
}

}


VF Page:

<apex:page controller="MyJobOrdersController">
<apex:form >

<apex:pageMessages ></apex:pageMessages>

<apex:pageBlock title="Sales/Recruiter Weekly Report Details" id="pageBlock">
<apex:pageBlockSection columns="4">

<apex:pageBlockTable value="{!JobOrders}" style="width:100%" var="a" rendered="{!NOT(ISNULL(JobOrders))}">
<apex:column value="{!a.Name}" style="width:250px"/>
</apex:pageBlockTable>

<apex:pageBlockTable value="{!Submissions}" style="width:100%" var="b" rendered="{!NOT(ISNULL(Submissions))}">
<apex:column value="{!b.Name}" style="width:100px"/>
</apex:pageBlockTable>

<apex:pageBlockTable value="{!Interviews}" style="width:100%" var="c" rendered="{!NOT(ISNULL(Interviews))}">
<apex:column value="{!c.Name}" style="width:100px"/>
</apex:pageBlockTable>

<apex:pageBlockTable value="{!Placements}" style="width:200%" var="d" rendered="{!NOT(ISNULL(Placements))}">
<apex:column value="{!d.Name}" style="width:250px"/>
</apex:pageBlockTable>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>