• Sayyad Amjad 7
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi All i need a help on to create VF page
i am having Custom Lead__c object i need to create Visual force page 
like thisUser-added imageSame working visule force page i need if any one have Vfpage and class please paste need urgent.
thanks in advance
My trigger is not working on exsting values

can any one plase help me

trigger oppattachment on Opportunity (before insert, before update) {


  Opportunity[] opptys = [SELECT Id, (SELECT Id, Name, ContentType FROM Attachments where  (name like  '%declaration%'))
                          //OR (name ='international declaration.txt'))  
                          FROM Opportunity 
                          where id IN :Trigger.newMap.keySet() AND (Not Billing_Address__c  like '%United Arab Emirates%') ];
  for(Opportunity o : opptys){
            Attachment[] attc = o.Attachments;
            System.debug('attc.size() : ' + attc.size());
            if(Trigger.newMap.get(o.Id).StageName=='Booked' || Trigger.newMap.get(o.Id).StageName=='Booked – Contract Received' )
            {
               if(attc.size()>0)
               {
                System.debug('Need to set Is_declaration_attached__c to true for Opportunity Id: ' + o.id);
                System.debug('just testing this: ' + Trigger.newMap.get(o.Id).Id);
             
                Trigger.newMap.get(o.Id).Is_declaration_attached__c = true;
                Trigger.newMap.get(o.Id).International_Client__c = True;
               // o.
               }
               else
               {
                Trigger.newMap.get(o.Id).addError('You are  International Clint Please provide the Internation Declaration Attachment file before saving this record the file name should be contain declaration');
                Trigger.newMap.get(o.Id).Is_declaration_attached__c = false; 
                Trigger.newMap.get(o.Id).International_Client__c = false;  
               }    
           }            
    }

}

 

when i created new opportunity this error Occurs but trigger working fine on exsiting Opportunity please help me need to solve urgent....

Error:
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger oppattachment caused an unexpected exception, contact your administrator: oppattachment: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.oppattachment: line 7, column 1

Hi All i need a help on to create VF page
i am having Custom Lead__c object i need to create Visual force page 
like thisUser-added imageSame working visule force page i need if any one have Vfpage and class please paste need urgent.
thanks in advance