• gregusa
  • NEWBIE
  • 75 Points
  • Member since 2008

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 18
    Replies
FYI... I received a notification that this known issue was fixed:

https://success.salesforce.com/apex/issues_view?id=a1p30000000T3rnAAC

It's not actually.  Last night one of my jobs hung again.  Same issue as before Summer '14 was deployed.  Keep trying to fix please.

GReg

This is an excerpt of code running in an After Update query:

 

 

    
Set<Id> setOpptsToDelete = new Set<Id>();

// Loop through the Opportunities being updated or deleted and see if there are any for the record types we want.

if(trigger.isDelete){
for (Opportunity o : Trigger.old) {
If (s.contains(o.RecordTypeId)){
setOpptsToDelete.add(o.Id);
}
}
}

List<AdvisorGAS_Production__c> listAdvisorGasDelete = new List<AdvisorGAS_Production__c>();

for (AdvisorGAS_Production__c agpDelete : [Select Id from AdvisorGAS_Production__c where Opportunity__c in :setOpptsToDelete]) {
listAdvisorGasDelete.add(agpDelete);
}

 

 

The query in red returns nothing yet when I manually query against the specific Opportunity Id (ie: Select Id from AdvisorGAS_Production__c where Opportunity__c = '0068000000X2fFg'), I get a value.

 

I can't figure out why it's not returning anything.  Here's some debug data I've set up and am getting:

 

USER_DEBUG|[51,5]|DEBUG|#### Trigger is delete. setOpptsToDelete.size = 1


|SOQL_EXECUTE_BEGIN|[98,47]|Aggregations: 0 |Select Id from AdvisorGAS_Production__c where Opportunity__c in :setOpptsToDelete

 

USER_DEBUG|[158,2]|DEBUG|###      listAdvisorGasDelete.size = 0

  • September 01, 2010
  • Like
  • 0

 

I have a trigger that needs to filter only the records affected that fall into a certain Record Type.  In the past I've made multiple calls to get some variables for the record types I want to use and then use if statements, but that is a poor use of resources.  I'd rather just pull those record types into a list or set so that I could match for a value in a set when looping.

 

Here's what I'd like to do:

 

// Create a list of RecordTypes we want to check for
List<RecordType> rtID = [SELECT Id FROM RecordType WHERE (SobjectType = 'Opportunity') AND (Name = 'Annuity' OR Name = 'Life' OR Name='LTC' OR Name = 'TLC')]; // Create a list for Opportunities that match our RecordType criteria List<Opportunity> opptsToWorkOn = new List<Opportunity>(); // Loop through the Opportunities being updated or deleted and see if there are any // for the record types we want. if(trigger.isDelete){ for (Opportunity o : Trigger.old) {

\\ #### HERE IS WHAT DOESN'T WORK ": rtID" - Does anyone know how to do this?
 If (o.RecordTypeId = : rtID) opptsToWorkOn.add(o); } } else{ for (Opportunity o : Trigger.new) { \\ #### I WOULD ALSO DO IT HERE! #########
If (o.RecordTypeId = : rtID) opptsToWorkOn.add(o); } }

 

Can someone point me in the right direction?

 

Thanks!

Greg

 

 

 

 

    \\ #### HERE IS WHAT DOESN'T WORK ": rtID" - Does anyone know how to do this?

Working on a trigger that creates a new opportunity when a particular type of opportunity is Closed Won.  I can't clone it because a number of things change, but for creating the new opportunity I need to be able to get at the values of not only the opportunity but the product line items.

 

There are two things I'm not sure of:

 

1) Are the product line items included via the Opportunity when I create a map of Opportunities?  If so, how do I reference them later when extracting certain values to apply to the new Opportunity?

 

2) How do I create the line items for the new opportunity?

 

Here's the code I have so far excluding the items referenced above:

 

 

trigger createRepSitesRecurringOpportunity on Opportunity (after insert, after update) { RecordType rt = [SELECT Id FROM RecordType WHERE Name = 'Rep Sites' AND SobjectType = 'Opportunity']; // Create map for Contact ID's & Opportunities, that match our RecordType criteria Map<Id,Opportunity> mapRepSitesOpportunities = new Map<Id, Opportunity>(); // Loop through the Opportunities being inserted and see if there are any for the Rep Sites record type and "Apply Recurring Billing = true". for (Opportunity o : trigger.new) { If ((o.RecordTypeId == rt.Id) && (o.Apply_Recurring_Billing__c == true)){ mapRepSitesOpportunities.put(o.Contact__c, o); } } system.debug('mapRepSitesOpportunities.size at Line 15 = ' + mapRepSitesOpportunities.size()); If (mapRepSitesOpportunities.size() > 0) { //Check for Rep Sites = Active and remove Opportunities from the list where Rep is no longer active. List<Id> contactidsForOpptToNotCreate = new List<Id>(); for (Contact c : [Select Id, Rep_Sites__c from Contact where Id in :mapRepSitesOpportunities.keySet()]) { If (c.Rep_Sites__c <> 'Active') { mapRepSitesOpportunities.remove(c.Id); } } } system.debug('mapRepSitesOpportunities.size at Line 29 = ' + mapRepSitesOpportunities.size()); //Create Oppt with the correct Recurring product/amount and set the Close Date to First Day of the next month If (mapRepSitesOpportunities.size() > 0) { List<Opportunity> opptsToInsert = new List<Opportunity>(); Opportunity newOppt = new Opportunity(); for(Opportunity oppt : [Select RecordTypeId, Name, Contact__c, AccountId, Amount From Opportunity where Id in :mapRepSitesOpportunities.values()]) { newOppt.Name = oppt.Name + ' Recurring Auto Generated'; newOppt.AccountId = oppt.AccountId; newOppt.Contact__c = oppt.Contact__c; newOppt.RecordTypeId = oppt.RecordTypeId; newOppt.CloseDate = Date.today(); //change this to first of next month newOppt.Amount = oppt.Amount; //stop mapping this once the product is created and amount set there. newOppt.StageName = 'Recurring Billing'; opptsToInsert.add(newOppt); } insert(opptsToInsert); } }

 

 Where do I go next?

 

I have the following query that works just like I want it:

 

 

Select a.Status__c, a.Notes__c, a.Id, a.Contracted_As__c, a.Confirm_Date__c, a.Commission_Level__c, a.Agent__c, a.Account__c From Appointment__c a WHERE Status__c = 'Active' AND RecordTypeId = '012400000005AKK'

 

except, instead of the Account ID (which is what is returned by a.Account__c), I want the account name.  I've tried looking through the SOQL  docs for relationship querries, I've tried Apex Explorer and Eclipse, but I can't seem to get it right.

 

Here's what I came up with in Apex Explorer except none of the Appointment__c fields are returned, just the account name, and I can't figure out how to put the where clause relating to items in the custom object:

 

 

Select a.Name, (Select Agent__c, Commission_Level__c, Confirm_Date__c, Contracted_As__c, Id, Notes__c, Status__c From Appointments__r) from Account a

 

Can someone point me in the right direction?

I've got everything configured and created for this Tutorial.

 

However, when I run it, including the included test app -- (and based on the docs it appears I should be able to run this from my local computer) -- 
the Outbound Messaging Sample Tester prompts me for my SalesForce credentials.  I type them in -- using my Developer License login (and security token), which is where I created the Outbound Message wsd, but it won't accept my credentials.

 

Do I need to turn something on in my developer org to accept these calls?

I have a VisualForce page that I'm building to override the standard tab for a custom object we have.  So far it's working out great except for 3 issues:

1) The "Name" field when rendered in the table is not clickable -- so there is no way to browse to the detail page of the item.

2) I can't seem to find a way to render the "Edit" and "Delete" buttons, or even the checkbox to enable multi-select events.  I've tried a number of things but nothing works.

3) Notice the "New" Button, is there a better way to redirect to the standard New page for this custom object?

Thanks in advance!

Here's the page:

Code:
<apex:page standardController="Override__c" recordSetVar="over" tabStyle="Override__c">
  <apex:sectionHeader title="Overrides" subtitle="Home"></apex:sectionHeader>  
  <apex:form id="thePage">    
      <apex:actionRegion >
          <apex:outputLabel value="View: " for="viewList"></apex:outputLabel>
          <apex:selectList id="viewList" size="1" value="{!filterId}">
              <apex:actionSupport event="onchange" rerender="thePage, navigation" />
              <apex:selectOptions value="{!listviewoptions}" />              
          </apex:selectList>          
      </apex:actionRegion>
 <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="/setup/ui/recordtypeselect.jsp—ent=01I80000000Cpmi&retURL=%2Fa00%2Fo&save_new_url=%2Fa00%2Fe%3FretURL%3D%252Fa00%252Fo" value="New"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!over}" var="o" id="list"> <apex:column value="{!o.name}" /> <apex:column value="{!o.Override_Date__c}" /> <apex:column value="{!o.Advisor_Rep__c}" /> <apex:column value="{!o.Institution__c}" /> <apex:column value="{!o.Opportunity__c}" /> <apex:column value="{!o.Override_Amount__c}" /> </apex:pageBlockTable> </apex:pageBlock> <apex:panelGrid columns="2" id="navigation"> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandLink> <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandLink> </apex:panelGrid> </apex:form> </apex:page>

 

I have a custom controller for a custom object.  When I include this code on the visualforce page:

Code:
    <apex:pageBlockTable value="{!over}" var="a" id="table">  
        <apex:column headerValue="Record Type">                     
          <apex:
            <apex:inputField value="{!a.RecordType}" />
        </apex:column> 
     </apex:pageBlockTable> 

 I get the following error:

Code:
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using Salesforce!

Error ID: 1550134988-19307 (1773106477)

 
I'm having a hard time understanding coding for RecordTypes.  Can anyone point me in the right direction?

I have a custom object called "Overrides".  I've been developing a VisualForce page and custom controller that would allow users to data enter as many rows that they want of Overrides objects, at one time -- basically set them all up before clicking "Save".  On save each Overrides object row is saved.  This all works just as I want.

Now I need to add RecordTypes into the mix.  Ideally I want to have a dropdown at the top of the page where they will choose the record type of all of the Overrides objects they are creating for this particular "Save" operation.  I'm new to Apex and am having a hard time figuring this out.

Can someone show some sample code how to:

1) setup the controller to populate the RecordType dropdown box
2) set the dropdown box RecordType selection to each Overrides object when saving

Here is my controller:

Code:
public class multiOverrideInsertController{ 
      
    public List<Override__c> over{get; set;}   
    
    public multiOverrideInsertController(){        
        over= new List<Override__c>();        
        over.add(new Override__c());    
    }        

    public void addrow(){        
        over.add(new Override__c());    
    }     
    
    public void removerow(){  
        Integer i = over.size();      
        over.remove(i-1);    
    }        

    public PageReference save(){       
        insert over;        
        PageReference home = new PageReference('/a00/o');        
        home.setRedirect(true);        
        return home;    
    }
}

Here's my VisualForce page:

Code:
<apex:page controller="multiOverrideInsertController">    
    <apex:form >        
    <apex:pageBlock title="Insert Multiple Overrides">                    
        <apex:pageBlockButtons >                
            <apex:commandButton value="Save" action="{!save}" rerender="error,table"/>            
        </apex:pageBlockButtons>                    
        <apex:pageMessages ></apex:pageMessages>
    <apex:pageBlockTable value="{!over}" var="a" id="table">      
        <apex:column headerValue="Opportunity">                    
            <apex:inputField value="{!a.Opportunity__c}" required="true" />                         
        </apex:column>     
        <apex:column headerValue="Institution">                    
            <apex:inputField value="{!a.Institution__c}" required="true" />                         
        </apex:column> 
        <apex:column headerValue="Advisor (Rep)">                    
            <apex:inputField value="{!a.Advisor_Rep__c}" required="true" />                         
        </apex:column>                              
        <apex:column headerValue="Override Date">                      
            <apex:inputField value="{!a.Override_Date__c}" required="true" />                          
        </apex:column>
        <apex:column headerValue="Override Amount">                    
            <apex:inputField value="{!a.Override_Amount__c}" required="true" />                           
        </apex:column>                                          
     </apex:pageBlockTable>   
     <apex:pageblockButtons location="bottom">   
         <div style="text-align:right;margin-right:30px;font-weight:bold;">             
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" /> &nbsp;|&nbsp;&nbsp;  
            <apex:commandLink id="RemoveRow" value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />
         </div>      
     </apex:pageblockButtons>                      
    </apex:pageBlock>    
    </apex:form>
</apex:page>




I need to be able to have two buttons in the footer of a pageBlockTable, one to add a row, one to remove a row.  The functionality behind the buttons works great if I have one or the other buttons in the VisualForce page at a time.  If I try the following, the last button is the only button that is rendered:

Code:
       <apex:pageBlockTable value="{!over}" var="a" id="table"> 
<apex:facet name="footer"> <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error"/> <apex:commandLink id="RemoveRow" value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" /> </apex:facet>

Shouldn't both buttons render given the above code>

Sorry if this is way too basic but I've been pouring over all of the books I got at dreamforce and the online docs and cannot figure this out.

I'm creating a Visualforce page for a custom object called "Override".  At minimum I'd like the user to be able to insert an Override record on this page (in one row).  However, all I can see in the docs is how to create a page that displays existing records and perform mass updates to them:

Code:
<apex:page standardController="Override__c" recordSetVar="overrides">
<apex:sectionHeader title="Overrides"></apex:sectionHeader>
    <apex:form >
        <apex:pageBlock id="pageRowInsert">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!overrides}" var="ovr">
               <apex:column ><apex:inputField value="{!ovr.Advisor_Rep__c}"  /></apex:column>
                <apex:column ><apex:inputField value="{!ovr.Institution__c}"  /></apex:column>
                <apex:column headerValue="Opportunity" value="{!ovr.Opportunity__c}"></apex:column>
                <apex:column headerValue="Override Amount" value="{!ovr.Override_Amount__c}"></apex:column>               
            </apex:pageBlockTable>
        </apex:pageBlock>
   </apex:form>
</apex:page>

How do I tell the system that I want empty  inputFields so that I can Insert a record?

And if it's not too much to ask, what I'd really want is for the user to be able to have 10 or 20 empty rows so they could setup 10 to 20 records at one time then press "SAVE" once and have all of them inserted.

FYI... I received a notification that this known issue was fixed:

https://success.salesforce.com/apex/issues_view?id=a1p30000000T3rnAAC

It's not actually.  Last night one of my jobs hung again.  Same issue as before Summer '14 was deployed.  Keep trying to fix please.

GReg

This is an excerpt of code running in an After Update query:

 

 

    
Set<Id> setOpptsToDelete = new Set<Id>();

// Loop through the Opportunities being updated or deleted and see if there are any for the record types we want.

if(trigger.isDelete){
for (Opportunity o : Trigger.old) {
If (s.contains(o.RecordTypeId)){
setOpptsToDelete.add(o.Id);
}
}
}

List<AdvisorGAS_Production__c> listAdvisorGasDelete = new List<AdvisorGAS_Production__c>();

for (AdvisorGAS_Production__c agpDelete : [Select Id from AdvisorGAS_Production__c where Opportunity__c in :setOpptsToDelete]) {
listAdvisorGasDelete.add(agpDelete);
}

 

 

The query in red returns nothing yet when I manually query against the specific Opportunity Id (ie: Select Id from AdvisorGAS_Production__c where Opportunity__c = '0068000000X2fFg'), I get a value.

 

I can't figure out why it's not returning anything.  Here's some debug data I've set up and am getting:

 

USER_DEBUG|[51,5]|DEBUG|#### Trigger is delete. setOpptsToDelete.size = 1


|SOQL_EXECUTE_BEGIN|[98,47]|Aggregations: 0 |Select Id from AdvisorGAS_Production__c where Opportunity__c in :setOpptsToDelete

 

USER_DEBUG|[158,2]|DEBUG|###      listAdvisorGasDelete.size = 0

  • September 01, 2010
  • Like
  • 0

 

I have a trigger that needs to filter only the records affected that fall into a certain Record Type.  In the past I've made multiple calls to get some variables for the record types I want to use and then use if statements, but that is a poor use of resources.  I'd rather just pull those record types into a list or set so that I could match for a value in a set when looping.

 

Here's what I'd like to do:

 

// Create a list of RecordTypes we want to check for
List<RecordType> rtID = [SELECT Id FROM RecordType WHERE (SobjectType = 'Opportunity') AND (Name = 'Annuity' OR Name = 'Life' OR Name='LTC' OR Name = 'TLC')]; // Create a list for Opportunities that match our RecordType criteria List<Opportunity> opptsToWorkOn = new List<Opportunity>(); // Loop through the Opportunities being updated or deleted and see if there are any // for the record types we want. if(trigger.isDelete){ for (Opportunity o : Trigger.old) {

\\ #### HERE IS WHAT DOESN'T WORK ": rtID" - Does anyone know how to do this?
 If (o.RecordTypeId = : rtID) opptsToWorkOn.add(o); } } else{ for (Opportunity o : Trigger.new) { \\ #### I WOULD ALSO DO IT HERE! #########
If (o.RecordTypeId = : rtID) opptsToWorkOn.add(o); } }

 

Can someone point me in the right direction?

 

Thanks!

Greg

 

 

 

 

    \\ #### HERE IS WHAT DOESN'T WORK ": rtID" - Does anyone know how to do this?

Working on a trigger that creates a new opportunity when a particular type of opportunity is Closed Won.  I can't clone it because a number of things change, but for creating the new opportunity I need to be able to get at the values of not only the opportunity but the product line items.

 

There are two things I'm not sure of:

 

1) Are the product line items included via the Opportunity when I create a map of Opportunities?  If so, how do I reference them later when extracting certain values to apply to the new Opportunity?

 

2) How do I create the line items for the new opportunity?

 

Here's the code I have so far excluding the items referenced above:

 

 

trigger createRepSitesRecurringOpportunity on Opportunity (after insert, after update) { RecordType rt = [SELECT Id FROM RecordType WHERE Name = 'Rep Sites' AND SobjectType = 'Opportunity']; // Create map for Contact ID's & Opportunities, that match our RecordType criteria Map<Id,Opportunity> mapRepSitesOpportunities = new Map<Id, Opportunity>(); // Loop through the Opportunities being inserted and see if there are any for the Rep Sites record type and "Apply Recurring Billing = true". for (Opportunity o : trigger.new) { If ((o.RecordTypeId == rt.Id) && (o.Apply_Recurring_Billing__c == true)){ mapRepSitesOpportunities.put(o.Contact__c, o); } } system.debug('mapRepSitesOpportunities.size at Line 15 = ' + mapRepSitesOpportunities.size()); If (mapRepSitesOpportunities.size() > 0) { //Check for Rep Sites = Active and remove Opportunities from the list where Rep is no longer active. List<Id> contactidsForOpptToNotCreate = new List<Id>(); for (Contact c : [Select Id, Rep_Sites__c from Contact where Id in :mapRepSitesOpportunities.keySet()]) { If (c.Rep_Sites__c <> 'Active') { mapRepSitesOpportunities.remove(c.Id); } } } system.debug('mapRepSitesOpportunities.size at Line 29 = ' + mapRepSitesOpportunities.size()); //Create Oppt with the correct Recurring product/amount and set the Close Date to First Day of the next month If (mapRepSitesOpportunities.size() > 0) { List<Opportunity> opptsToInsert = new List<Opportunity>(); Opportunity newOppt = new Opportunity(); for(Opportunity oppt : [Select RecordTypeId, Name, Contact__c, AccountId, Amount From Opportunity where Id in :mapRepSitesOpportunities.values()]) { newOppt.Name = oppt.Name + ' Recurring Auto Generated'; newOppt.AccountId = oppt.AccountId; newOppt.Contact__c = oppt.Contact__c; newOppt.RecordTypeId = oppt.RecordTypeId; newOppt.CloseDate = Date.today(); //change this to first of next month newOppt.Amount = oppt.Amount; //stop mapping this once the product is created and amount set there. newOppt.StageName = 'Recurring Billing'; opptsToInsert.add(newOppt); } insert(opptsToInsert); } }

 

 Where do I go next?

 

Hi!

I've created a trigger to create a task everytime someone creates an Opportunity's product. But I have a problem, the trigger creates the task twice! I couldn't find yet the problem. Could someone tell what's wrong in the code?

Thanks! :smileyhappy:

 

trigger createTask2 on OpportunityLineItem (before insert, before update) {

    List<Task> tasks = new List<Task>();
    List<OpportunityLineItem> OppLIs = Trigger.new;
    
    for (OpportunityLineItem OppLI : OppLIs) {
        
        //Obtengo el Id del usuario que creo la oportunidad
        Opportunity Opp = [ Select OwnerId from Opportunity where id=:OppLI.OpportunityId limit 1 ];
        
        //User usuario = [ Select Name from ]

        //Obtengo el día que se vence el producto
        Date diaVenc = OppLI.Fecha_de_vencimiento__c;
        Datetime dhReminder = datetime.newInstance(diaVenc.year(), diaVenc.month(),diaVenc.day());
        dhReminder.addHours(10);



        Task tsk = new Task(whatID = OppLI.OpportunityId, 
                            Ownerid = Opp.OwnerId, 
                            Subject = 'test', 
                            ActivityDate = diaVenc,
                            IsReminderSet = true,
                            ReminderDateTime = dhReminder );
        tasks.add(tsk);
        
    }
    
    insert tasks;
}
 

 

 

  • October 22, 2009
  • Like
  • 0
I have a VisualForce page that I'm building to override the standard tab for a custom object we have.  So far it's working out great except for 3 issues:

1) The "Name" field when rendered in the table is not clickable -- so there is no way to browse to the detail page of the item.

2) I can't seem to find a way to render the "Edit" and "Delete" buttons, or even the checkbox to enable multi-select events.  I've tried a number of things but nothing works.

3) Notice the "New" Button, is there a better way to redirect to the standard New page for this custom object?

Thanks in advance!

Here's the page:

Code:
<apex:page standardController="Override__c" recordSetVar="over" tabStyle="Override__c">
  <apex:sectionHeader title="Overrides" subtitle="Home"></apex:sectionHeader>  
  <apex:form id="thePage">    
      <apex:actionRegion >
          <apex:outputLabel value="View: " for="viewList"></apex:outputLabel>
          <apex:selectList id="viewList" size="1" value="{!filterId}">
              <apex:actionSupport event="onchange" rerender="thePage, navigation" />
              <apex:selectOptions value="{!listviewoptions}" />              
          </apex:selectList>          
      </apex:actionRegion>
 <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="/setup/ui/recordtypeselect.jsp—ent=01I80000000Cpmi&retURL=%2Fa00%2Fo&save_new_url=%2Fa00%2Fe%3FretURL%3D%252Fa00%252Fo" value="New"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!over}" var="o" id="list"> <apex:column value="{!o.name}" /> <apex:column value="{!o.Override_Date__c}" /> <apex:column value="{!o.Advisor_Rep__c}" /> <apex:column value="{!o.Institution__c}" /> <apex:column value="{!o.Opportunity__c}" /> <apex:column value="{!o.Override_Amount__c}" /> </apex:pageBlockTable> </apex:pageBlock> <apex:panelGrid columns="2" id="navigation"> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandLink> <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandLink> </apex:panelGrid> </apex:form> </apex:page>

 

I have a custom controller for a custom object.  When I include this code on the visualforce page:

Code:
    <apex:pageBlockTable value="{!over}" var="a" id="table">  
        <apex:column headerValue="Record Type">                     
          <apex:
            <apex:inputField value="{!a.RecordType}" />
        </apex:column> 
     </apex:pageBlockTable> 

 I get the following error:

Code:
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using Salesforce!

Error ID: 1550134988-19307 (1773106477)

 
I'm having a hard time understanding coding for RecordTypes.  Can anyone point me in the right direction?

I have a custom object called "Overrides".  I've been developing a VisualForce page and custom controller that would allow users to data enter as many rows that they want of Overrides objects, at one time -- basically set them all up before clicking "Save".  On save each Overrides object row is saved.  This all works just as I want.

Now I need to add RecordTypes into the mix.  Ideally I want to have a dropdown at the top of the page where they will choose the record type of all of the Overrides objects they are creating for this particular "Save" operation.  I'm new to Apex and am having a hard time figuring this out.

Can someone show some sample code how to:

1) setup the controller to populate the RecordType dropdown box
2) set the dropdown box RecordType selection to each Overrides object when saving

Here is my controller:

Code:
public class multiOverrideInsertController{ 
      
    public List<Override__c> over{get; set;}   
    
    public multiOverrideInsertController(){        
        over= new List<Override__c>();        
        over.add(new Override__c());    
    }        

    public void addrow(){        
        over.add(new Override__c());    
    }     
    
    public void removerow(){  
        Integer i = over.size();      
        over.remove(i-1);    
    }        

    public PageReference save(){       
        insert over;        
        PageReference home = new PageReference('/a00/o');        
        home.setRedirect(true);        
        return home;    
    }
}

Here's my VisualForce page:

Code:
<apex:page controller="multiOverrideInsertController">    
    <apex:form >        
    <apex:pageBlock title="Insert Multiple Overrides">                    
        <apex:pageBlockButtons >                
            <apex:commandButton value="Save" action="{!save}" rerender="error,table"/>            
        </apex:pageBlockButtons>                    
        <apex:pageMessages ></apex:pageMessages>
    <apex:pageBlockTable value="{!over}" var="a" id="table">      
        <apex:column headerValue="Opportunity">                    
            <apex:inputField value="{!a.Opportunity__c}" required="true" />                         
        </apex:column>     
        <apex:column headerValue="Institution">                    
            <apex:inputField value="{!a.Institution__c}" required="true" />                         
        </apex:column> 
        <apex:column headerValue="Advisor (Rep)">                    
            <apex:inputField value="{!a.Advisor_Rep__c}" required="true" />                         
        </apex:column>                              
        <apex:column headerValue="Override Date">                      
            <apex:inputField value="{!a.Override_Date__c}" required="true" />                          
        </apex:column>
        <apex:column headerValue="Override Amount">                    
            <apex:inputField value="{!a.Override_Amount__c}" required="true" />                           
        </apex:column>                                          
     </apex:pageBlockTable>   
     <apex:pageblockButtons location="bottom">   
         <div style="text-align:right;margin-right:30px;font-weight:bold;">             
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" /> &nbsp;|&nbsp;&nbsp;  
            <apex:commandLink id="RemoveRow" value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />
         </div>      
     </apex:pageblockButtons>                      
    </apex:pageBlock>    
    </apex:form>
</apex:page>




I need to be able to have two buttons in the footer of a pageBlockTable, one to add a row, one to remove a row.  The functionality behind the buttons works great if I have one or the other buttons in the VisualForce page at a time.  If I try the following, the last button is the only button that is rendered:

Code:
       <apex:pageBlockTable value="{!over}" var="a" id="table"> 
<apex:facet name="footer"> <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error"/> <apex:commandLink id="RemoveRow" value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" /> </apex:facet>

Shouldn't both buttons render given the above code>

Sorry if this is way too basic but I've been pouring over all of the books I got at dreamforce and the online docs and cannot figure this out.

I'm creating a Visualforce page for a custom object called "Override".  At minimum I'd like the user to be able to insert an Override record on this page (in one row).  However, all I can see in the docs is how to create a page that displays existing records and perform mass updates to them:

Code:
<apex:page standardController="Override__c" recordSetVar="overrides">
<apex:sectionHeader title="Overrides"></apex:sectionHeader>
    <apex:form >
        <apex:pageBlock id="pageRowInsert">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!overrides}" var="ovr">
               <apex:column ><apex:inputField value="{!ovr.Advisor_Rep__c}"  /></apex:column>
                <apex:column ><apex:inputField value="{!ovr.Institution__c}"  /></apex:column>
                <apex:column headerValue="Opportunity" value="{!ovr.Opportunity__c}"></apex:column>
                <apex:column headerValue="Override Amount" value="{!ovr.Override_Amount__c}"></apex:column>               
            </apex:pageBlockTable>
        </apex:pageBlock>
   </apex:form>
</apex:page>

How do I tell the system that I want empty  inputFields so that I can Insert a record?

And if it's not too much to ask, what I'd really want is for the user to be able to have 10 or 20 empty rows so they could setup 10 to 20 records at one time then press "SAVE" once and have all of them inserted.