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

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

2 Answers 2

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
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .