• sreekanth cheera
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 4
    Replies
public class Requirement1 {

    public static void beforeinsert(list<Contact> con){
        
        for(Contact c:con){
            if(string.isblank(c.MobilePhone) && c.Phone!=null && c.Type__c=='prospect'){
                c.MobilePhone=c.Phone;
                
            }
            else{
                if(string.isBlank(c.phone) && c.MobilePhone!=null){
                    c.phone=null;
                }
            
             
            }
        }
    }
    public static void beforeupdate(list<Contact> con1){
     
        for(contact cn:con1){
            if(cn.Office_Phone__c!=null && string.isBlank(cn.Phone)&& string.isBlank(cn.MobilePhone)){
                cn.MobilePhone=cn.Office_Phone__c;
              
            }
        }
     
    }
}
I have one Account record named Banking
And it has child contact records.

And I created one more Account named Finance 
And the requirement is Banking should be deleted and whatever the banking chid records to transfer to the finance account
when Account is set as inctive(picklist) , all underlying Contacts should automatically be marked as incative(picklist) and the Expiredate on the Accountt  should be blank.
when Account is set as inctive(picklist) , all underlying Contacts should automatically be marked as incative(picklist) and the Expiredate on the Accountt  should be blank.