• Dave Sullivan
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I may be going about this the wrong way entirely, but I've built a custom controller to report on campaigns.  I'd like to use this same controller with multiple vf pages that will be rendered as a dashboard component where the only change is what campaign is being reported on.  However, I can't seem to figure out how to hardcode the campaign id into the VF page source and pass it up to the controller to use in its queries.  Does anyone have a suggestion on how to do this?  Very much appreciated.

I have a dashboard that has a VF component on it that displays a simple table.  I have it scheduled to email the report on a daily basis to several people.  The VF component does not render in the e-mail.  Is there a way to fix this?  Or, is there a way to give people in my org who do not have salesforce logins access to the dashboard information?  Can I, for example, render the whole thing as a PDF and send that in an email?

I have a dashboard that has a VF component on it that displays a simple table.  I have it scheduled to email the report on a daily basis to several people.  The VF component does not render in the e-mail.  Is there a way to fix this?  Or, is there a way to give people in my org who do not have salesforce logins access to the dashboard information?  Can I, for example, render the whole thing as a PDF and send that in an email?

Hi all,

 

I am new to Visual Force and trying to create my first page!  I created a Class & VF page on the Campaign Object.  What I am trying to do is pull all of the Leads that are associated to the Campaign that have been Disqualified.

 

If I use html, I can display the data on the VF page just fine, but I would like to use APEX instead.

 

Here is the Class:

 

 

public with sharing class CampaignMetricsRL {

    public CampaignMetricsRL(ApexPages.StandardController controller) {

    }


public PageReference ViewData() {

return null;
}
 
List<Campaign> rqs;

Id cid = ApexPages.currentPage().getParameters().get('id');

 public List<Campaign> getCampaign() {

  if(rqs == null){
  rqs = [select Id, Name, Actual_Cost__c, NumberOfLeads, NumberOfContacts, NumberOfOpportunities,
         NumberOfWonOpportunities, AmountWonOpportunities, OwnerId, CreatedDate
         from Campaign
         limit 1];
  }
  return  rqs;
 }


public Integer getDQLeads() {

return [

select count() from CampaignMember

where Lead.Lead_is_Disqualified__c = True AND Campaignid = :cid
      
];

} 
}

 

Here is the Visual Force Page:

 

 

<apex:page standardController="Campaign" extensions="CampaignMetricsRL" showHeader="false">


<apex:form id="test">
  <apex:pageblock title="">

      <tr>     
           
        <apex:pageBlockTable value="{!Campaign}" var="C" id="table">
                                                     

           <apex:column >                      
              
                 <table>
 
 <tr><td align="center"></td></tr>                 
 <tr><td align="center"></td></tr>
 <tr><td align="center"><u><font size="4" color="#000000">Leads</font></u></td></tr>
 <tr><td align="center"><font size="3" color="#000000"><b>{!C.NumberOfLeads}</b></font></td></tr>                
                    
                 </table>       
            
           </apex:column> 
   
        
           <apex:column >                      
              
                 <table>

 <tr><td align="center"><u><font size="4" color="#000000">Disqualified Leads</font></u></td></tr>
 <tr><td align="center"><font size="3" color="#000000"><b>{!DQLeads}</b></font></td></tr>                
                    
                 </table>       
            
           </apex:column>
         

    
      
                
  </apex:pageblock>
    
</apex:form>


</apex:page>

 I would love to use APEX over HTML.  Any help would be appreciated!

 

Thanks,

Alex

 

 

  • September 15, 2010
  • Like
  • 0

I have a web-to-lead (or web-to-anything) form created. Upon submission, I'd like to ideally do the following:

 

1) If they aren't already in SFDC, create them as a lead and update various fields;

2) If they aren't a member of a specific campaign, add them to the campaign and update their status;

3) If they are a member of the campaign, update their status.

 

The basic web-to-lead form is causing me issues so I think this might have to be done with an Apex Trigger. When the current form is submitted, it works ok for someone already in SFDC. It does create a lead even though they are already in the system as either a contact or lead. But their campaign member status is updated correctly and if they aren't a member of the campaign already then they are added to it.

 

But if they are not in SFDC it doesn't work as I hoped. They are added as a lead (which is perfect)but it generates an error to the user when trying to add them to a campaign. My guess is that the way the form is setup, it's doing a lookup of the contact/lead's ID via the email address field and adding them to the campaign that way. And when the person is not already in SFDC (even though they are being added as a lead during the form submission) it can't retrieve their contact or lead ID and therefore it fails.

 

So, is this a problem best met with an Apex Trigger? 

  • March 09, 2010
  • Like
  • 0