• sfdc guru 17
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi All

I have created a custom object which is having image for every record.so how to create a vf page for displaying all image .

User-added image
Hi All
 How to write test class for the my method 
public static void updating(List<Contact> triggerNew,Map<Id,Contact> triggerOldMap){
        try{
            
            List<String> addressIds = new List<String>();
            for(Contact cont : triggerNew){
                if(cont.location__c != null && cont.location__c !=triggerOldMap.get(cont.Id).location__c ){
                    addressIds.add(cont.location__c);
                }
                
            }
            
            Map<Id,custom__c> add = new Map<Id,custom__c>([Select Id,,name,field1__C,field2__C,field3__C
                                                             from custom__c where id IN: addressIds]);
                


		for(Contact cont : triggerNew){
                
                if(cont.location__c != null && cont.location__c !=triggerOldMap.get(cont.Id).location__c ){
                    if(add.get(cont.location__c) != null){


                         cont.field1__C = add.get(cont.location__c).Name;
                         cont.field2__C = add.get(cont.location__c).field2__C;
                         cont.field3__C = add.get(cont.location__c).field3__C;
                                   
                    }
                }
                
                
            }
               
        }catch(DmlException e) {
               Logger.error('DMLException : '+e.getMessage(), null, 'updating');
        }catch(Exception ex) {
               Logger.error('DMLException : '+ex.getMessage(), null, 'updating');
        }
       }
Hi All

I have created a custom object which is having image for every record.so how to create a vf page for displaying all image .

User-added image
Hi All
 How to write test class for the my method 
public static void updating(List<Contact> triggerNew,Map<Id,Contact> triggerOldMap){
        try{
            
            List<String> addressIds = new List<String>();
            for(Contact cont : triggerNew){
                if(cont.location__c != null && cont.location__c !=triggerOldMap.get(cont.Id).location__c ){
                    addressIds.add(cont.location__c);
                }
                
            }
            
            Map<Id,custom__c> add = new Map<Id,custom__c>([Select Id,,name,field1__C,field2__C,field3__C
                                                             from custom__c where id IN: addressIds]);
                


		for(Contact cont : triggerNew){
                
                if(cont.location__c != null && cont.location__c !=triggerOldMap.get(cont.Id).location__c ){
                    if(add.get(cont.location__c) != null){


                         cont.field1__C = add.get(cont.location__c).Name;
                         cont.field2__C = add.get(cont.location__c).field2__C;
                         cont.field3__C = add.get(cont.location__c).field3__C;
                                   
                    }
                }
                
                
            }
               
        }catch(DmlException e) {
               Logger.error('DMLException : '+e.getMessage(), null, 'updating');
        }catch(Exception ex) {
               Logger.error('DMLException : '+ex.getMessage(), null, 'updating');
        }
       }