user updating account record,if billing address is change update all its child contacts mail address field same as account billing address using trigger
Kindly refer the sample code and modify it accordingly :-
trigger changeShippingAddress on Account (before insert){
for(Account aObj : Trigger.new){
//We should first check whether the user is passing null data
if(aObj.BillingStreet!=null){
aObj.ShippingStreet=aObj.BillingStreet;
}
if(a.BillingCity!=null){
aObj.ShippingCity=aObj.BillingCity;
}
if(a.BillingState!=null){
aObj.ShippingState=aObj.BillingState;
}
if(a.BillingPostalCode!=null){
aObj.ShippingPostalCode=aObj.BillingPostalCode;
}
if(a.BillingCountry!=null){
aObj.ShippingCountry=aObj.BillingCountry;
}
}
}
It would be difficult for the community to provide the complete implementation of test class. Hope you understand this. However, we can help you with error if you face any in your test code.
Kindly refer the sample code and modify it accordingly :-
It would be difficult for the community to provide the complete implementation of test class. Hope you understand this. However, we can help you with error if you face any in your test code.
Thanks & Regards,
Priya Ranjan