function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Colin LoretzColin Loretz 

Map truncation

I'm having an issue with the data from a map being truncated.

I have a map consisting of:

Code:
Map<ID, CVB_Contact__c> m = new Map<Id, CVB_Contact__c>();

Everything works fine when I run some logic and add records to the map, I can see in my log that the data is being added to the map. However, if I try to output the map to the log file I get:
Code:
{Id:{record}, Id:{record}, Id:{record}, Id:{record}, 
Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, ...}

Basically, it's truncating it after 10 map records.

I'm passing this map to a php script using an external callout and need to fix the truncation. Is there a limit to the size of a map? If so, what other options do I have?

I have tried sending the map in both GET and POST but neither affect the truncation as I can see that it is truncated in the log, before I even send it.
 
Thanks




Message Edited by Colin Loretz on 08-25-2008 09:38 AM
Colin LoretzColin Loretz
A little update on this: I created some example classes to reproduce my issue. Below is the code and the log output.


20080826184321.743:Class.longArrays.longArray: line 14, column 9: 
###### My Map: {0=0, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9, ...}
20080826184321.743:Class.longArrays.longArray: line 15, column 9:
###### My Map Size: 20
20080826184321.743:Class.longArrays.longArray: line 24, column 8:
Single email queued for send (pending commit) : subject: Long array test,
senderDisplayName: Long Array, bccSender: false, saveAsActivity: true,
useSignature: true, toAddresses: [email@email.com], htmlBody:
This is the map: <br><br> {0=0, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9, ...},

 
Code:
global class longArrays {
 

 WebService static void longArray(){
  
  
  Map<Integer, Integer> m = new Map<Integer, Integer>();
  
  for(Integer i = 0; i < 20; i++)
  {
   m.put(i, i);
  }
  
  system.debug('###### My Map: ' + m);
  system.debug('###### My Map Size: ' + m.size());
  
  
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    String[] toAddresses = new string[] {'email@email.com'};
    mail.setToAddresses(toAddresses);
    mail.setSenderDisplayName('Long Array');
    mail.setSubject('Long array test');
    mail.setHtmlBody('This is the map: <br><br> ' + m);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
  

 }
 
 static testMethod void TEST_mapArrays() {
  
  longArray();
  
}

}

 Is there a way to access the rest of the map? At first I thought it was not showing everything because it is in the log file but when passing the variable in an email (or in my preferred situation an HTTP callout), it passes 10 records followed by an ellipsis (...);