• djbakerman.ax666
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hello -

 

I'm attempting to use apex to send an outbound email via apex.  I created a custom object, and one of the fields is an email address.  Is it possible to use the recordId of the custom object as the whatTo object for the setTargetObjectID so that the email field of my custom object is used (and by nature the remaining merge fields of my custom object)?

 

Thanks,


Daniel

Hello -

 

I'm trying to use a custom controller to display a picklist of a custom object. The below code works when I place it in anonymous, but fails when I upload the class. Maybe I need a test class?

 

public with sharing class ebsController{

    public List<SelectOption> getDatacenter()
    {  
           List<SelectOption> options = new List<SelectOption>();        
           Schema.DescribeFieldResult fieldResult = Pod_UPS__c.Datacenters__c.getDescribe();
           List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();    
           
           options.add(new SelectOption('','--Select Data Center --'));
        
           for( Schema.PicklistEntry f : ple)
           {
              options.add(new SelectOption(f.getLabel(), f.getValue()));
              System.debug(logginglevel.INFO,f.getLabel() + ',' + f.getValue());
           }
               
           return options;
    }
}

 

 

Thanks, Daniel

Hello -

 

I'm trying to write a visualforce page that will redirect a user to the Case Record Type's page layout for a given case record type.  For example, if the case record type is "change" then the page redirects to the "change" case edit page.  I seem to be stuck with the redirect after the submit button is pressed - nothing seems to happen.  Below is the code:

 

public with sharing class RecordTypeListCon {
private List<SelectOption> items;

// property that reads the value from the Component attribute
public string sObjectType
{
get;
set;
}

//public RecordTypeListCon(ApexPages.StandardController controller) {
  //      this.controller = controller;
//}

public List<SelectOption> getItems() {
 List<SelectOption> items = new List<SelectOption>();

 //default value
 items.add(new SelectOption('','--Select Record Type --'));

 //query force.com database to get the record type of the requested object.
 for(RecordType rt: [select id,name from recordtype where sobjecttype=:sObjectType]) {
      items.add(new SelectOption(rt.id,rt.name));
  }
 return items;
}

public System.PageReference action()
{


  PageReference nextPage = new PageReference('/500/e?RecordTypeID='apexpages.currentPage().getParameters(Values(getItems())););

  nextPage.setredirect(true);
  return nextPage;
 
 
}

}

 

Below is the VF page:

 

 <apex:page controller="RecordTypeListCon">
<h1>Please select a case record type:</h1>
<p>
</p>
 <apex:form >
<c:RecordTypeListCon value="{!items}" sObjectType="Case"></c:RecordTypeListCon>
<apex:commandButton value="Go" action="{!action}" rerender="dynamic"/>
</apex:form>
</apex:page>

 

Hello -

 

I'm trying to use a custom controller to display a picklist of a custom object. The below code works when I place it in anonymous, but fails when I upload the class. Maybe I need a test class?

 

public with sharing class ebsController{

    public List<SelectOption> getDatacenter()
    {  
           List<SelectOption> options = new List<SelectOption>();        
           Schema.DescribeFieldResult fieldResult = Pod_UPS__c.Datacenters__c.getDescribe();
           List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();    
           
           options.add(new SelectOption('','--Select Data Center --'));
        
           for( Schema.PicklistEntry f : ple)
           {
              options.add(new SelectOption(f.getLabel(), f.getValue()));
              System.debug(logginglevel.INFO,f.getLabel() + ',' + f.getValue());
           }
               
           return options;
    }
}

 

 

Thanks, Daniel

Hello -

 

I'm trying to write a visualforce page that will redirect a user to the Case Record Type's page layout for a given case record type.  For example, if the case record type is "change" then the page redirects to the "change" case edit page.  I seem to be stuck with the redirect after the submit button is pressed - nothing seems to happen.  Below is the code:

 

public with sharing class RecordTypeListCon {
private List<SelectOption> items;

// property that reads the value from the Component attribute
public string sObjectType
{
get;
set;
}

//public RecordTypeListCon(ApexPages.StandardController controller) {
  //      this.controller = controller;
//}

public List<SelectOption> getItems() {
 List<SelectOption> items = new List<SelectOption>();

 //default value
 items.add(new SelectOption('','--Select Record Type --'));

 //query force.com database to get the record type of the requested object.
 for(RecordType rt: [select id,name from recordtype where sobjecttype=:sObjectType]) {
      items.add(new SelectOption(rt.id,rt.name));
  }
 return items;
}

public System.PageReference action()
{


  PageReference nextPage = new PageReference('/500/e?RecordTypeID='apexpages.currentPage().getParameters(Values(getItems())););

  nextPage.setredirect(true);
  return nextPage;
 
 
}

}

 

Below is the VF page:

 

 <apex:page controller="RecordTypeListCon">
<h1>Please select a case record type:</h1>
<p>
</p>
 <apex:form >
<c:RecordTypeListCon value="{!items}" sObjectType="Case"></c:RecordTypeListCon>
<apex:commandButton value="Go" action="{!action}" rerender="dynamic"/>
</apex:form>
</apex:page>

 

This is my simple page and controller but it does not work at all........every time i click the submit button it refreshes the current page
---Page-----
<apex:page controller="MyController" tabStyle="Contact">
<apex:form >
 <apex:pageBlock>
  <apex:commandButton action="{!submit}" value="Export" id="BtnExport"/>              
 </apex:pageBlock>
</apex:form>
</apex:page>
---Controller-----
public class MyController { 
   public PageReference submit() {
        PageReference secondPage= new PageReference('www.google.com');
        secondPage.setRedirect(true);
        return secondPage;
    }
}