0
return ApexPages.getMessages().size() -1;

Iam Using aboveLine in Visualforce Page controller. Please explain About this line

0

ApexPages.getMessages() returns a list of messages associated with the current context. If we specify ApexPages.getMessages().size()-1 it will return the latest entry or the last entry in the list of messages. Thanks.

0

This will return the count (size) of the messages list and reduced by 1.

(i.e) ApexPages.getMessages() has 2 messages, then

ApexPages.getMessages().size() will return 2 and

this one - ApexPages.getMessages().size() -1; will return 1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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