• kavya kavi
  • NEWBIE
  • 5 Points
  • Member since 2016

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

I have a situation where I need to send a mail to the customer one day before a given appointment date. The appointments can be made once, twice or many times. So each time when the record changes with a specific change in the appointment date. I need to trigger an email one day before the appointment date.
Am using a professional edition and have an option of using process builder. But I cannot use IsChanged() function in the criteria section of the process builder to send the scheduled actions. Is there any other way I could achileve this. Also there are no workflows. 

How can I automate the email alert in the above said scenario. Please help.
 
I am trying to fetch the details of a tab. is there a way I can fetch the tab discription field.? 


User-added image
I have used the Schema.DescribeTabResult to get the other details of a tab. ? 
I have used the same controller for 2 pages. however on my second vf page am not able to see the result. 
VF PAGE 1:
<apex:page standardController="Account" extensions="sampleConqqqqqqq">
   <apex:form >
  <apex:pageBlock id="out1">
  <apex:outputLabel >Select the App </apex:outputLabel>&nbsp; 
    <apex:selectList value="{!selectedApp}" multiselect="false" size="1">
     <apex:selectOptions value="{!items}"/>
         <apex:actionSupport action="{!incrementCounter}"  rerender="out1" event="onchange"/>
   </apex:selectList>
  
    <apex:outputPanel id="out1" rendered="{!IF(AND(NOT(ISBLANK(lstwrapperTabs)),lstwrapperTabs.size>0),true,false)}">
        <apex:pageBlockTable id="pgBlock" value="{!lstwrapperTabs}" var="v" > 
          
             <apex:column headerValue="checkbox">
             <apex:facet name="checkbox">
             <apex:inputCheckbox />
             </apex:facet>
            <apex:inputCheckbox value="{!v.isSelected}" id="InputId"/>
           </apex:column>         
          
          <apex:column headerValue="Tab Name" value="{!v.tabDescription}"/>
        </apex:pageBlockTable> 
        <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts"  rendered="{!IF(AND(NOT(ISBLANK(lstwrapperTabs)),lstwrapperTabs.size>0),true,false)}" /> 
    </apex:outputPanel>
    
    <apex:outputPanel id="out2" rendered="{!IF(AND(NOT(ISBLANK(selectedtabs)),selectedtabs.size>0),true,false)}">
        <apex:pageBlockTable value="{!selectedtabs}" var="s" id="block2">
            <apex:column headerValue="Tab Name" value="{!s.tabDescription}"/>
            <apex:column headerValue="Tab Type" value="{!s.tabIsCustom}"/>
            <apex:column value="{!s.isSelected}"/>
             <apex:column headerValue="checkbox">
             <apex:facet name="checkbox">
             <apex:inputCheckbox />
             </apex:facet>
            <apex:inputCheckbox value="{!s.isSelected}" id="InputId"/>
           </apex:column>
        </apex:pageBlockTable>
		
        <apex:commandButton value="create pdf" action="{!savePDF}"   />
     </apex:outputPanel>
    </apex:pageBlock>
</apex:form>
</apex:page>
 
controller:
public class sampleConqqqqqqq  {

    public String selectedTheme { get; set; }



    public boolean showtable=false;
    public String tabSetDesc { get; set; }
    public list<String> tabNames {get; set;}
    public list<String> tabDesc  {get; set;}
    public list<String> tabDescription  {get; set;}
    public list<String> tabIsCustom{get; set;}
    public List<wrapper> lstwrapperTabs {get;set;}
    public List<wrapper> selectedtabs   {get;set;}
    public list<Integer> dummy{get;set;}
    public String selectedApp;
    public list<String> themes{get;set;}
    public Integer i=0;
    public list<String> temp = new List<string>();
    public String getselectedApp() {
    return selectedApp;
    }
     
    public void setselectedApp(String selectedApp) {
        this.selectedApp = selectedApp;
    }
    
        
   
    public sampleConqqqqqqq() {
     
    }
    

    public sampleConqqqqqqq(ApexPages.StandardController controller) {
     boolean showtable=false;
     list<string> temp;
      
    }
       
    public List<SelectOption> getItems() {
        List<AppMenuItem> apps=[SELECT Id,Label FROM AppMenuItem];
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('--None','--None--'));
        for(AppMenuItem a: apps)
        options.add(new selectoption(a.label,a.label));
        system.debug('apps in org'+options.size());
        return options;
    }
 
     public pageReference incrementCounter(){
     system.debug('inside the incriment');
     system.debug('selected value'+selectedApp); 
     tabNames       = new list<String>();
     tabDescription = new list<String>();
     tabIsCustom    = new List<string> ();
     lstwrapperTabs = new List<wrapper>();
     temp           = new List<String>();
     dummy = new List<Integer>();
     // Get tab set describes for each app
      List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs();
    // Iterate through each tab set describe for each app and display the info
    if(tabSetDesc!=null && tabSetDesc.size()>0)
    for(DescribeTabSetResult tsr : tabSetDesc) {
    String appLabel = tsr.getLabel();
    tabNames.add(appLabel);
    System.debug('Label: ' + appLabel);
        
    if (appLabel == selectedApp) {
        List<Schema.DescribeTabResult> tabDesc = tsr.getTabs();
        System.debug('-- Tab information for the Selected app --');
        for(Schema.DescribeTabResult tr : tabDesc) {
            String TabLabel;
            System.debug('getLabel: ' + tr.getLabel());
            //if(TabLabel!=null && !string.isempty(TabLabel))
            if(tr.getLabel()!=null && !string.isempty(tr.getLabel()))
            tabDescription.add(tr.getLabel());
            
            if(tr.isCustom()){
                 TabLabel='custom tab'; 
                 }
            else { 
            TabLabel='standard tab';
            }
            tabIsCustom.add(TabLabel);
           // deskTabs.add(tr);
         }
    }
}
   system.debug('tabNames for selected apps'+tabDescription.size());
   system.debug('tabNames'+tabNames.size()); 
    
   for(Integer i=0;i<tabDescription.size();i++){
   //for(Schema.DescribeTabResult objTab: deskTabs)
   lstwrapperTabs.add(new wrapper(tabDescription[i],tabIsCustom[i]));
              
   }
  return null;
    
 }   
   
   public class wrapper{
   public String tabDescription{get;set;}
   public boolean isSelected{get;set;}
   public String  tabIsCustom{get;set;}
   
   public Wrapper (String tabDescription,String tabIsCustom){
   this.tabDescription=tabDescription;
   this.tabIsCustom=tabIsCustom;
   isSelected=false;
   }
   }
   
   public void ProcessSelected(){
      i++;
     showtable=true;
     selectedtabs=new list<wrapper>();
     List<string> temp = new List<string>();
     if(lstwrapperTabs!=null && lstwrapperTabs.size()>0)
     for(wrapper  wrapobj : lstwrapperTabs ){
           if(wrapobj.isSelected==true){
           selectedtabs.add(wrapobj);
           temp.add(wrapobj.tabDescription);
           }
            
         }
         
         system.debug('temp'+temp.size());
         system.debug('selectedtabs'+selectedtabs.size());
         system.debug('no of calls'+i);
         
      } 

public void getThemes() {
        system.debug('inside themes');
        list<string> temp = new list<string>();
        for(wrapper  wrapobj : lstwrapperTabs ){
           if(wrapobj.isSelected==true){
           selectedtabs.add(wrapobj);
           temp.add(wrapobj.tabDescription);
           }
            
         }
        
    }

public PageReference savePDF() {
       PageReference pageRef = new PageReference('/apex/PageThatGeneratesPdf');
  pageRef.setRedirect(false);
  return pageRef;  
   }



}
 
VF page:2

<apex:page showHeader="false"
           renderAs="PDF"
           cache="true" controller="sampleConqqqqqqq">
<apex:pageBlock >
    <apex:outputPanel>
        <apex:pageBlockTable value="{!selectedtabs}" var="s">
            <apex:column headerValue="Tab Name" value="{!s.tabDescription}"/>
            <apex:column headerValue="Tab Type" value="{!s.tabIsCustom}"/>
        </apex:pageBlockTable>
    </apex:outputPanel>
</apex:pageBlock>
</apex:page>
am I missing anything? correct me if iam wrong 
 
I have used the same controller for 2 pages. however on my second vf page am not able to see the result. 
VF PAGE 1:
<apex:page standardController="Account" extensions="sampleConqqqqqqq">
   <apex:form >
  <apex:pageBlock id="out1">
  <apex:outputLabel >Select the App </apex:outputLabel>&nbsp; 
    <apex:selectList value="{!selectedApp}" multiselect="false" size="1">
     <apex:selectOptions value="{!items}"/>
         <apex:actionSupport action="{!incrementCounter}"  rerender="out1" event="onchange"/>
   </apex:selectList>
  
    <apex:outputPanel id="out1" rendered="{!IF(AND(NOT(ISBLANK(lstwrapperTabs)),lstwrapperTabs.size>0),true,false)}">
        <apex:pageBlockTable id="pgBlock" value="{!lstwrapperTabs}" var="v" > 
          
             <apex:column headerValue="checkbox">
             <apex:facet name="checkbox">
             <apex:inputCheckbox />
             </apex:facet>
            <apex:inputCheckbox value="{!v.isSelected}" id="InputId"/>
           </apex:column>         
          
          <apex:column headerValue="Tab Name" value="{!v.tabDescription}"/>
        </apex:pageBlockTable> 
        <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts"  rendered="{!IF(AND(NOT(ISBLANK(lstwrapperTabs)),lstwrapperTabs.size>0),true,false)}" /> 
    </apex:outputPanel>
    
    <apex:outputPanel id="out2" rendered="{!IF(AND(NOT(ISBLANK(selectedtabs)),selectedtabs.size>0),true,false)}">
        <apex:pageBlockTable value="{!selectedtabs}" var="s" id="block2">
            <apex:column headerValue="Tab Name" value="{!s.tabDescription}"/>
            <apex:column headerValue="Tab Type" value="{!s.tabIsCustom}"/>
            <apex:column value="{!s.isSelected}"/>
             <apex:column headerValue="checkbox">
             <apex:facet name="checkbox">
             <apex:inputCheckbox />
             </apex:facet>
            <apex:inputCheckbox value="{!s.isSelected}" id="InputId"/>
           </apex:column>
        </apex:pageBlockTable>
		
        <apex:commandButton value="create pdf" action="{!savePDF}"   />
     </apex:outputPanel>
    </apex:pageBlock>
</apex:form>
</apex:page>
 
controller:
public class sampleConqqqqqqq  {

    public String selectedTheme { get; set; }



    public boolean showtable=false;
    public String tabSetDesc { get; set; }
    public list<String> tabNames {get; set;}
    public list<String> tabDesc  {get; set;}
    public list<String> tabDescription  {get; set;}
    public list<String> tabIsCustom{get; set;}
    public List<wrapper> lstwrapperTabs {get;set;}
    public List<wrapper> selectedtabs   {get;set;}
    public list<Integer> dummy{get;set;}
    public String selectedApp;
    public list<String> themes{get;set;}
    public Integer i=0;
    public list<String> temp = new List<string>();
    public String getselectedApp() {
    return selectedApp;
    }
     
    public void setselectedApp(String selectedApp) {
        this.selectedApp = selectedApp;
    }
    
        
   
    public sampleConqqqqqqq() {
     
    }
    

    public sampleConqqqqqqq(ApexPages.StandardController controller) {
     boolean showtable=false;
     list<string> temp;
      
    }
       
    public List<SelectOption> getItems() {
        List<AppMenuItem> apps=[SELECT Id,Label FROM AppMenuItem];
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('--None','--None--'));
        for(AppMenuItem a: apps)
        options.add(new selectoption(a.label,a.label));
        system.debug('apps in org'+options.size());
        return options;
    }
 
     public pageReference incrementCounter(){
     system.debug('inside the incriment');
     system.debug('selected value'+selectedApp); 
     tabNames       = new list<String>();
     tabDescription = new list<String>();
     tabIsCustom    = new List<string> ();
     lstwrapperTabs = new List<wrapper>();
     temp           = new List<String>();
     dummy = new List<Integer>();
     // Get tab set describes for each app
      List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs();
    // Iterate through each tab set describe for each app and display the info
    if(tabSetDesc!=null && tabSetDesc.size()>0)
    for(DescribeTabSetResult tsr : tabSetDesc) {
    String appLabel = tsr.getLabel();
    tabNames.add(appLabel);
    System.debug('Label: ' + appLabel);
        
    if (appLabel == selectedApp) {
        List<Schema.DescribeTabResult> tabDesc = tsr.getTabs();
        System.debug('-- Tab information for the Selected app --');
        for(Schema.DescribeTabResult tr : tabDesc) {
            String TabLabel;
            System.debug('getLabel: ' + tr.getLabel());
            //if(TabLabel!=null && !string.isempty(TabLabel))
            if(tr.getLabel()!=null && !string.isempty(tr.getLabel()))
            tabDescription.add(tr.getLabel());
            
            if(tr.isCustom()){
                 TabLabel='custom tab'; 
                 }
            else { 
            TabLabel='standard tab';
            }
            tabIsCustom.add(TabLabel);
           // deskTabs.add(tr);
         }
    }
}
   system.debug('tabNames for selected apps'+tabDescription.size());
   system.debug('tabNames'+tabNames.size()); 
    
   for(Integer i=0;i<tabDescription.size();i++){
   //for(Schema.DescribeTabResult objTab: deskTabs)
   lstwrapperTabs.add(new wrapper(tabDescription[i],tabIsCustom[i]));
              
   }
  return null;
    
 }   
   
   public class wrapper{
   public String tabDescription{get;set;}
   public boolean isSelected{get;set;}
   public String  tabIsCustom{get;set;}
   
   public Wrapper (String tabDescription,String tabIsCustom){
   this.tabDescription=tabDescription;
   this.tabIsCustom=tabIsCustom;
   isSelected=false;
   }
   }
   
   public void ProcessSelected(){
      i++;
     showtable=true;
     selectedtabs=new list<wrapper>();
     List<string> temp = new List<string>();
     if(lstwrapperTabs!=null && lstwrapperTabs.size()>0)
     for(wrapper  wrapobj : lstwrapperTabs ){
           if(wrapobj.isSelected==true){
           selectedtabs.add(wrapobj);
           temp.add(wrapobj.tabDescription);
           }
            
         }
         
         system.debug('temp'+temp.size());
         system.debug('selectedtabs'+selectedtabs.size());
         system.debug('no of calls'+i);
         
      } 

public void getThemes() {
        system.debug('inside themes');
        list<string> temp = new list<string>();
        for(wrapper  wrapobj : lstwrapperTabs ){
           if(wrapobj.isSelected==true){
           selectedtabs.add(wrapobj);
           temp.add(wrapobj.tabDescription);
           }
            
         }
        
    }

public PageReference savePDF() {
       PageReference pageRef = new PageReference('/apex/PageThatGeneratesPdf');
  pageRef.setRedirect(false);
  return pageRef;  
   }



}
 
VF page:2

<apex:page showHeader="false"
           renderAs="PDF"
           cache="true" controller="sampleConqqqqqqq">
<apex:pageBlock >
    <apex:outputPanel>
        <apex:pageBlockTable value="{!selectedtabs}" var="s">
            <apex:column headerValue="Tab Name" value="{!s.tabDescription}"/>
            <apex:column headerValue="Tab Type" value="{!s.tabIsCustom}"/>
        </apex:pageBlockTable>
    </apex:outputPanel>
</apex:pageBlock>
</apex:page>
am I missing anything? correct me if iam wrong 
 
Help Needed.

Challenge Not yet complete... here's what's wrong: 
The 'Google Info' custom button was not found. Make sure that it is a Detail Page Button (not link) and that its added to the page layout. If you are still having problems, ensure that you are NOT using Record types for the Contact object. This challenge will not work with Record types so you will need to sign up for a new DE org and use that instead for this module.