Thursday, March 27, 2014

Today, when i tried to export attachment related to account. i could not export because salesforce doesn't provide way of using string function on lookup object.

so what i did :

integer i=0;
for(Attachment a :[SELECT id,parentid  FROM Attachment]){
 string s =a.parentid ;
  if(s.startsWith('001')){
     i = i+1;
   }
}

system.debug('NUMBER OF ATTACHMENT==============='+i);

No comments:

Post a Comment