salesforceapex-code

array length in Salesforce


I'm getting this error from the line of code below:

Error: AddIMRConroller Compile Error: Initial term of field expression must be a concrete SObject: LIST at line 21 column 23

string[] str1 = imrTable.split('\r\n');
    System.debug( str1.length); 

Solution

  • In Salesforce we need to use size() method instead of the length property. This is something different then Java.