• Will Edwards
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 16
    Replies
I'm trying to write a trigger (I think) that will send an email whenever a specific field changes on a campaign member record. Basically, the goal is to send an email to an email address associated with a lookup field on the page. Thanks. If this can be done with a workflow alert, even better.
This is the line I'm trying to fix:
 
<apex:column headerValue="Status" headerClass="headerStyle" value="{!con.Status__c}" />

This doesn't work:
 
<apex:column headerValue="Status" headerClass="headerStyle" value="{!LEFT(con.Status__c,500)}" />

Thanks
I want to click a button on a campaign member record that will:
  1. Update the campaign record status
  2. Create a new related event that I can update
Thanks.
In an Apex class, I'd like to take two lists of contacts, merge them, remove duplicate contacts, and then sort them? Any suggestions? Thanks.
 
I'm trying to add a lead to a campaign using VF and Apex. I'd like to add all leads entered via the form to a campaign with status "Responded."

Can you help out? Thanks.

Here's my controller:
 
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
         
}



And my VF:
 
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Register for Digital Accelerator" showHeader="false"
           standardStylesheets="true">
           <head>
           <script src='https://www.google.com/recaptcha/api.js'></script>
           </head>
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form id="theForm">
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Register for Digital Accelerator"
                               collapsible="false"
                               columns="1">
        <div class = "requiredInput">
        <div class = "requiredBlock"></div>
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}" required="true"/>
         <apex:inputField value="{!Lead.Nickname__c}" label="Nickname" required="False"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.Company}" required="true"/>
         <apex:inputField value="{!Lead.Phone}" required="true"/>
         <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/>
         <apex:inputHidden value="{!Lead.Campaign.Id}" id="hiddenField3"/>
         <apex:inputHidden value="{!Member_Status}" id="hiddenField4"/>



         <script>
         document.getElementById('{!$Component.theForm}').elements['{!$Component.hiddenField3}'].value = '7013B000000MAma';
         </script>
         <script>
         document.getElementById('{!$Component.theForm}').elements['{!$Component.hiddenField4}'].value = 'Responded';
         </script>
        
        </div>
        </apex:pageBlockSection>

     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>

 
I'm trying to fill a hidden custom field through a parameter provided via the URL in a Visualforce page on a Force.com site that creates leads. I'm getting the following error: "Error: Literal value is required for attribute id in apex:inputHidden in NomineeRegistration at line 38 column 99."
Here's my Apex:
 
public class myWeb2LeadExtension {

private final Lead weblead;

public myWeb2LeadExtension(ApexPages.StandardController
                            stdController) {
   weblead = (Lead)stdController.getRecord();
}

 public PageReference saveLead() {
   try {
   insert(weblead);
   }
   catch(System.DMLException e) {
       ApexPages.addMessages(e);
       return null;
   }
   PageReference p = Page.ThankYou;
   p.setRedirect(true);
   return p;
 }

And the highlights of the VF page:
 
<apex:page standardController="Lead"
       extensions="myWeb2LeadExtension"
       title="Register for Digital Accelerator" showHeader="false"
       standardStylesheets="true">

<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<apex:form >
<apex:messages id="error"
               styleClass="errorMsg"
               layout="table"
               style="margin-top:1em;"/>
  <apex:pageBlock title="" mode="edit">
    <apex:pageBlockButtons >
       <apex:commandButton value="Submit"
                           action="{!saveLead}"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="Register for Digital Accelerator"
                           collapsible="false"
                           columns="1">
    <div class = "requiredInput">
    <div class = "requiredBlock"></div>
     <apex:inputField value="{!Lead.FirstName}" required="true"/>
     <apex:inputField value="{!Lead.LastName}" required="true"/>
     <apex:inputField value="{!Lead.Nickname__c}" required="false"/>
     <apex:inputField value="{!Lead.Title}" required="true"/>
     <apex:inputField value="{!Lead.Email}" required="true"/>
     <apex:inputField value="{!Lead.Company}" required="true"/>
     <apex:inputField value="{!Lead.Phone}" required="true"/>
     <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/>

    </div>
    <apex:inputHidden id="{!Lead.Referred_By__c}"
                      value="{!$CurrentPage.parameters.Referred"/>

    </apex:pageBlockSection>
 </apex:pageBlock>
I would like to use Force.com, Visualforce, and Apex to create a two-stage lead creation process. I'd like for person A to access a Visualforce page on a Force.com site.

Here's the Visualforce code for the first nomination form.
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Submit Nominee for Digital Accelerator" showHeader="false"
           standardStylesheets="true">
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form >
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact Us"
                               collapsible="false"
                               columns="1">
        <div class = "requiredInput">
        <div class = "requiredBlock"></div>
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}" required="true"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.Company}" required="true"/>
        </div>
        <input type="hidden" name="Campaign_ID" value="{$CurrentPage.parameters.MeetingValue}" />
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>
And the Apex controller:
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
}
This will create a lead with some of the information. I'd then like to send a link to the nominee with most of the information filled in and request they add some follow up information. I was thinking of having a hidden value of the lead ID passed through the URL and then writing an Apex controller to update that specific lead.

Any recommendations?

 
I'm trying to put a Chatter feed on a custom VF page. I thought I could to the following:

<apex:page >
<chatter:feedWithFollowers entityId="{!$CurrentPage.Id}" />
</apex:page>

But there's no Id associated with the page. Any tips? Thanks.
I'd like to create a trigger that posts a field from a campaign member record to the associated contact's Chatter feed after the campaign status is changed to closed. Thanks.
Using pageBlockTable, I'd like to show a long list of Members (contacts) with various Renewal statuses. I'd like the column header to appear on all pages. Is this possible?
<apex:pageBlockTable value="{!FinalConList}" var="con">
              
    <apex:column headerValue="Renewal" headerClass="headerStyle"
        value="{!con.CV_Impact_Status__c}" />
    <apex:column headerValue="Member" headerClass="headerStyle" 
        value="{!con.FirstName} {!con.LastName} - {!con.Account.Company_Nickname__c}" />   
                         
</apex:pageBlockTable>
I want to create a VF page that shows fields from all contact records that belong to accounts related to a particular campaign. To do that I'll need to create a class in Apex that pulls all contacts with any of the account IDs that belong to campaign members. I understand it will involved nested statements, but I'm not quite sure how to get started. Thanks.
I have several values for a child campaign that I'd like to display as columns rather than rows.

I would like the first row to be Hidden_Speaker_Name__c and the second row to be Average_Speaker_Value__c, rather than columbs as they are now. Thanks.

My controller:
public class CampaignController {
    public Campaign camp {get; set;}
    public CampaignController(ApexPages.StandardController controller) {
        camp = (Campaign) controller.getRecord();

        if(camp != null && camp.Id != null) {
            camp = [Select Id, Name, (Select Id, Average_Speaker_Value__c, Hidden_Speaker_Name__c, Type 
            FROM ChildCampaigns
            WHERE Type = 'Speakers')
            
            FROM Campaign WHERE Id =: camp.Id];
        }
    }
}
My current code:
 
<apex:pageBlockTable value="{!camp.ChildCampaigns}"
        var="cc"
        >

        <apex:column headerValue="Speaker" headerClass="headerStyle" value="!cc.Hidden_Speaker_Name__c}"/>
        <apex:column headerValue="Score" headerClass="headerStyle" value="!cc.Average_Speaker_Value__c}"/>

</apex:pageBlockTable>


 
I'm trying to pull a field from all child campaigns and reference it on a Visualforce page accessed via a button on the parent campaign. Is there anyway to do that? Thanks.
Using pageBlockTable, I'd like to show a long list of Members (contacts) with various Renewal statuses. I'd like the column header to appear on all pages. Is this possible?
<apex:pageBlockTable value="{!FinalConList}" var="con">
              
    <apex:column headerValue="Renewal" headerClass="headerStyle"
        value="{!con.CV_Impact_Status__c}" />
    <apex:column headerValue="Member" headerClass="headerStyle" 
        value="{!con.FirstName} {!con.LastName} - {!con.Account.Company_Nickname__c}" />   
                         
</apex:pageBlockTable>
I'm trying to write a trigger (I think) that will send an email whenever a specific field changes on a campaign member record. Basically, the goal is to send an email to an email address associated with a lookup field on the page. Thanks. If this can be done with a workflow alert, even better.
This is the line I'm trying to fix:
 
<apex:column headerValue="Status" headerClass="headerStyle" value="{!con.Status__c}" />

This doesn't work:
 
<apex:column headerValue="Status" headerClass="headerStyle" value="{!LEFT(con.Status__c,500)}" />

Thanks
I want to click a button on a campaign member record that will:
  1. Update the campaign record status
  2. Create a new related event that I can update
Thanks.
In an Apex class, I'd like to take two lists of contacts, merge them, remove duplicate contacts, and then sort them? Any suggestions? Thanks.
 
I'm trying to add a lead to a campaign using VF and Apex. I'd like to add all leads entered via the form to a campaign with status "Responded."

Can you help out? Thanks.

Here's my controller:
 
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
         
}



And my VF:
 
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Register for Digital Accelerator" showHeader="false"
           standardStylesheets="true">
           <head>
           <script src='https://www.google.com/recaptcha/api.js'></script>
           </head>
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form id="theForm">
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Register for Digital Accelerator"
                               collapsible="false"
                               columns="1">
        <div class = "requiredInput">
        <div class = "requiredBlock"></div>
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}" required="true"/>
         <apex:inputField value="{!Lead.Nickname__c}" label="Nickname" required="False"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.Company}" required="true"/>
         <apex:inputField value="{!Lead.Phone}" required="true"/>
         <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/>
         <apex:inputHidden value="{!Lead.Campaign.Id}" id="hiddenField3"/>
         <apex:inputHidden value="{!Member_Status}" id="hiddenField4"/>



         <script>
         document.getElementById('{!$Component.theForm}').elements['{!$Component.hiddenField3}'].value = '7013B000000MAma';
         </script>
         <script>
         document.getElementById('{!$Component.theForm}').elements['{!$Component.hiddenField4}'].value = 'Responded';
         </script>
        
        </div>
        </apex:pageBlockSection>

     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>

 
I'm trying to fill a hidden custom field through a parameter provided via the URL in a Visualforce page on a Force.com site that creates leads. I'm getting the following error: "Error: Literal value is required for attribute id in apex:inputHidden in NomineeRegistration at line 38 column 99."
Here's my Apex:
 
public class myWeb2LeadExtension {

private final Lead weblead;

public myWeb2LeadExtension(ApexPages.StandardController
                            stdController) {
   weblead = (Lead)stdController.getRecord();
}

 public PageReference saveLead() {
   try {
   insert(weblead);
   }
   catch(System.DMLException e) {
       ApexPages.addMessages(e);
       return null;
   }
   PageReference p = Page.ThankYou;
   p.setRedirect(true);
   return p;
 }

And the highlights of the VF page:
 
<apex:page standardController="Lead"
       extensions="myWeb2LeadExtension"
       title="Register for Digital Accelerator" showHeader="false"
       standardStylesheets="true">

<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<apex:form >
<apex:messages id="error"
               styleClass="errorMsg"
               layout="table"
               style="margin-top:1em;"/>
  <apex:pageBlock title="" mode="edit">
    <apex:pageBlockButtons >
       <apex:commandButton value="Submit"
                           action="{!saveLead}"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="Register for Digital Accelerator"
                           collapsible="false"
                           columns="1">
    <div class = "requiredInput">
    <div class = "requiredBlock"></div>
     <apex:inputField value="{!Lead.FirstName}" required="true"/>
     <apex:inputField value="{!Lead.LastName}" required="true"/>
     <apex:inputField value="{!Lead.Nickname__c}" required="false"/>
     <apex:inputField value="{!Lead.Title}" required="true"/>
     <apex:inputField value="{!Lead.Email}" required="true"/>
     <apex:inputField value="{!Lead.Company}" required="true"/>
     <apex:inputField value="{!Lead.Phone}" required="true"/>
     <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/>

    </div>
    <apex:inputHidden id="{!Lead.Referred_By__c}"
                      value="{!$CurrentPage.parameters.Referred"/>

    </apex:pageBlockSection>
 </apex:pageBlock>
I would like to use Force.com, Visualforce, and Apex to create a two-stage lead creation process. I'd like for person A to access a Visualforce page on a Force.com site.

Here's the Visualforce code for the first nomination form.
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Submit Nominee for Digital Accelerator" showHeader="false"
           standardStylesheets="true">
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form >
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact Us"
                               collapsible="false"
                               columns="1">
        <div class = "requiredInput">
        <div class = "requiredBlock"></div>
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}" required="true"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.Company}" required="true"/>
        </div>
        <input type="hidden" name="Campaign_ID" value="{$CurrentPage.parameters.MeetingValue}" />
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>
And the Apex controller:
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
}
This will create a lead with some of the information. I'd then like to send a link to the nominee with most of the information filled in and request they add some follow up information. I was thinking of having a hidden value of the lead ID passed through the URL and then writing an Apex controller to update that specific lead.

Any recommendations?

 
I'm trying to put a Chatter feed on a custom VF page. I thought I could to the following:

<apex:page >
<chatter:feedWithFollowers entityId="{!$CurrentPage.Id}" />
</apex:page>

But there's no Id associated with the page. Any tips? Thanks.
I want to create a VF page that shows fields from all contact records that belong to accounts related to a particular campaign. To do that I'll need to create a class in Apex that pulls all contacts with any of the account IDs that belong to campaign members. I understand it will involved nested statements, but I'm not quite sure how to get started. Thanks.
I'm trying to pull a field from all child campaigns and reference it on a Visualforce page accessed via a button on the parent campaign. Is there anyway to do that? Thanks.