You need to sign in to do that
Don't have an account?
Aiyaz
Save Error: Unexpected Token
Just testing out some code from the Force.com Workbook and I'm receiving an error on line 14 saying "Save Error: Unexpected Token". Any idea on what is causing this..?
Code:
public class MileageUtil { static final Integer MAX_MILES_PER_DAY = 500; // Method that takes an array of mileage records as an argument public static void areMilesAllowed(Mileage__c[] miles){ //NOte: "UserInfo" is a built-in type that supplies global context information //about the current user. String createdbyId = UserInfo.getUserId(); Double totalMiles = 0; // add miles that were created in previous requests for today for(Mileage__c mq:[SELECT miles__c FROM Mileage__c WHERE Date__c = TODAY AND Mileage__c.createdById = :createdbyId AND miles__c!= null){ totalMiles+=mq.miles__c; } //Totals the mailes in the request for(Mileage__c m:miles) { totalMiles += m.miles__c; if(totalMiles > MAX_MILES_PER_DAY) m.addError('Mileage request exceeds daily limit: ' + MAX_MILES_PER_DAY); } } }
Aiyaz
I fixed the error. Silly error on my end, (missed a bracket)