• CJ413121
  • NEWBIE
  • 5 Points
  • Member since 2011

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

I am looking for a solution to automatically send an email alert to users who have not logged in to SF in the past 90 days (based on thier last login history field. I attempted a workflow/email alert but the User object is not available as a selection. Please help!

I am newbie and found out when I tried to deploy to production, I need to create a test method for the following code. This code came from a cookbook and it works fabulous in staging, but I can't deploy to production because it returns 0% test coverage. Any help would be appreciated!

 

 

 

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;
     }
}

 

 

Here is my Visualforce page:

 

<apex:page standardController="Lead" extensions="myWeb2LeadExtension" title="Contact Us" 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="Save" action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact us" collapsible="false" columns="1">
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Company}" />
         <apex:inputField value="{!Lead.Phone}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.City}" required="true"/>
         <apex:inputField value="{!Lead.State}" required="true"/>
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define>
 </apex:composition> 
</apex:page>

I am looking for a solution to automatically send an email alert to users who have not logged in to SF in the past 90 days (based on thier last login history field. I attempted a workflow/email alert but the User object is not available as a selection. Please help!

I am newbie and found out when I tried to deploy to production, I need to create a test method for the following code. This code came from a cookbook and it works fabulous in staging, but I can't deploy to production because it returns 0% test coverage. Any help would be appreciated!

 

 

 

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;
     }
}

 

 

Here is my Visualforce page:

 

<apex:page standardController="Lead" extensions="myWeb2LeadExtension" title="Contact Us" 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="Save" action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact us" collapsible="false" columns="1">
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Company}" />
         <apex:inputField value="{!Lead.Phone}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.City}" required="true"/>
         <apex:inputField value="{!Lead.State}" required="true"/>
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define>
 </apex:composition> 
</apex:page>