• Lynn the AFTD SysAdmin
  • NEWBIE
  • 25 Points
  • Member since 2015
  • IT Consultant
  • AFTD

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
I am trying to create a new list button on opportunity where the user should be prompted to choose from 3 of our currently 7 opportunity record types.  I have to clue where to even begin solving this. My Button is currently defined as follows:

/006/e?
ent=Opportunity
&retURL=%2F{!Contact.Id}
&accid={!Account.Id}
&opp3={!Contact.Name} - Donation {!YEAR( TODAY() )}
&opp9={!TODAY()}
&opp11=Prospect ID

When the button is used it defaults to the master Record Type, but I want to design the button so it prompts the user to select the Record Type from a subset of types.

Any suggestions ideas are welcome. At a minimum I would like to at least have the user prompted to select any of the current record types.
I have written the following piece of batch apex code to be run nightly (using a scheduable class call). I have tested all the stage and date conditions seperately, but I cannot seem to get the class to work. I get no error messages on compilation or run time, but nothing ever happens (the calls for follow-up or email alert aren't invoked). I am drawing a blank an have stared at the code for too long, any help would be appreciated!

Cheers! 

global class UpdateOppstoDormant implements Database.Batchable<sObject>{

    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT Id, StageName, CloseDate, NextActivityDate__c, LastActivityDate FROM Opportunity WHERE StageName !=\''+String.escapeSingleQuotes('Received')+'\'';
        return Database.getQueryLocator(query);
        
    } //end query
    
    global void execute(Database.BatchableContext BC, List<Opportunity> scope){

        List<ID> DormantProspectIDs = New List<ID>();
        List<ID> DormantRenewalIDs  = New List<ID>();
       
        for(sObject s : scope){
            
            Opportunity o = (Opportunity)s;
            
            //check if opportunities are prospects
            if(o.Stagename == 'Prospect ID' || o.Stagename == 'Prospect Engaged'){
                
                // check activity dates to establish Prospect dormancy
                if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 30) &&
                    (date.today().daysBetween(o.CloseDate) < 180) &&
                           (o.NextActivityDate__c == NULL || o.NextActivityDate__c < date.today()) ){

                    DormantProspectIDs.add(o.ID);
                      
                } //end activity date check
            } //end dormant prospects
            
            //check if opportunities are renewals
            if(o.StageName == 'Renewal Potential' || o.StageName == 'Renewal Likely'){
               
                // check activity dates to establish Renewal dormancy
                if((o.LastActivityDate == NULL || o.LastActivityDate.daysBetween(date.today()) > 90) &&
                (o.NextActivityDate__c == NULL || date.today().daysBetween(o.NextActivityDate__c) > 90) ){
                    
                    DormantRenewalIDs.add(o.ID);
                    
                } //end activity date check
                
            } //end dormant Renewals

        }
        
        //for Dormant Prospects
        List<Opportunity> DormantProspects = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantProspectIDs];
        
          InactiveOpp.NewFollowUpTask(DormantProspects);
          InactiveOpp.OwnerEmailAllert(DormantProspects);
      
        //for Dormant Renewals
        List<Opportunity> DormantRenewals = [SELECT id, OwnerID FROM Opportunity WHERE id in :DormantRenewalIDs];
        
          InactiveOpp.RenewalFolloUpTask(DormantRenewals);
          InactiveOpp.PotentialRenewalDomantAllert(DormantRenewals);
        
    } //end execute
    
    global void finish(Database.BatchableContext BC){
        
    } //end finish

} //end class