• gweston
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I am trying to iterate through the result of a soql result and I am getting a number of errors.

 

 public ApexPages.StandardSetController accountRecords{
        get {
            if(accountRecords ==null){
                return new ApexPages.StandardSetController(
                         Database.getQueryLocator(
          [SELECT name FROM Service_Region__C WHERE Service_Region__c.Advisor_Account__c NOT IN 
                (SELECT AccountId FROM Opportunity 
                 WHERE IsClosed =false)] ));
            }
            return accountRecords;
            
   Iterator<sObject> accountsIterator = accountRecords.getRecords().iterator();
      while ( accountsIterator.hasNext() ){
        sObject recordEach =  accountsIterator.next();
        recordEach.put('GEOPointe', geopointe.API(id1, accountRecords.Id, geopointe.API.units.MILES));
      }
          
        }   

        
        private set;
    }

 

 

 One error is "Save error: Non-void method might not return a value or might have statement after a return statement."

 

and the second one is related to the geopointe.API :

: Method does not exist or incorrect signature: geopointe.API(Id, Id, geopointe.API.units)

 

Any help would be appreciated.

I am trying to pre-populate an opportunity field when creating it from an related account. I think the trigger should look something like this but I keep getting stumped by errors.

 

trigger populateBillingInfo on Opportunity (before insert) {


for(Opportunity o: Trigger.new){
	if(o.CCNumber__c == null || o.CCNumber__c.equals('')){
		
	
o.CCNumber__c = [Select CCNumber__c from Account  Where Id = :o.AccountId];
		

	}
	}
}

 

 

I am trying to create a simple trigger that check is a field has updated and if so adds a datetime stamp in another field.

 

I am getting a read only error and I know it is because I am trying to update the trigger.old. The problem is I am new and do not know how to update the trigger.new. I assume you are supposed t switch back but I can not figure out how to do it

 

Here is my code so far

 

trigger CreateDispositionTimeStamp on Lead (after insert, after update)

{



for (Lead l : System.Trigger.new){

    Lead beforeUpdate = System.Trigger.oldMap.get(l.Id);
   if(l.Status != beforeUpdate.Status){
  
  l.Last_Disposition_Update__c=datetime.now();
   }
}
}

 

 

Any help would be appreciated.

I am trying to iterate through the result of a soql result and I am getting a number of errors.

 

 public ApexPages.StandardSetController accountRecords{
        get {
            if(accountRecords ==null){
                return new ApexPages.StandardSetController(
                         Database.getQueryLocator(
          [SELECT name FROM Service_Region__C WHERE Service_Region__c.Advisor_Account__c NOT IN 
                (SELECT AccountId FROM Opportunity 
                 WHERE IsClosed =false)] ));
            }
            return accountRecords;
            
   Iterator<sObject> accountsIterator = accountRecords.getRecords().iterator();
      while ( accountsIterator.hasNext() ){
        sObject recordEach =  accountsIterator.next();
        recordEach.put('GEOPointe', geopointe.API(id1, accountRecords.Id, geopointe.API.units.MILES));
      }
          
        }   

        
        private set;
    }

 

 

 One error is "Save error: Non-void method might not return a value or might have statement after a return statement."

 

and the second one is related to the geopointe.API :

: Method does not exist or incorrect signature: geopointe.API(Id, Id, geopointe.API.units)

 

Any help would be appreciated.

I am trying to pre-populate an opportunity field when creating it from an related account. I think the trigger should look something like this but I keep getting stumped by errors.

 

trigger populateBillingInfo on Opportunity (before insert) {


for(Opportunity o: Trigger.new){
	if(o.CCNumber__c == null || o.CCNumber__c.equals('')){
		
	
o.CCNumber__c = [Select CCNumber__c from Account  Where Id = :o.AccountId];
		

	}
	}
}

 

 

I am trying to create a simple trigger that check is a field has updated and if so adds a datetime stamp in another field.

 

I am getting a read only error and I know it is because I am trying to update the trigger.old. The problem is I am new and do not know how to update the trigger.new. I assume you are supposed t switch back but I can not figure out how to do it

 

Here is my code so far

 

trigger CreateDispositionTimeStamp on Lead (after insert, after update)

{



for (Lead l : System.Trigger.new){

    Lead beforeUpdate = System.Trigger.oldMap.get(l.Id);
   if(l.Status != beforeUpdate.Status){
  
  l.Last_Disposition_Update__c=datetime.now();
   }
}
}

 

 

Any help would be appreciated.