0

Any gueses why I am getting error?

for(Case cs : cases){
                Integer limit = Integer.valueOf(Label.Old_Request_Limit); // line-28

                if(cs.OldRequest__c == 'Yes' && caseList.size() > limit){
                    cs.addError(Label.Old_Request_Error_Message);
                }   
            }

The error coming:

expecting a semi-colon, found 'limit'

2
  • 1
    I can't find any error. Maybe limit is a reserved keyword in Apex. Did you try to change the limit variable name? Aug 10, 2017 at 13:01
  • Right. When I change variable name limit to value. Its work. Aug 10, 2017 at 13:08

1 Answer 1

1

Limit is an reserved word in salesforce , You can't used as variable name.

Find All reserved Word Reserved Keywords

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.