function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akansha RanaAkansha Rana 

i want case contact email to automatically update to custom object RMA email field

AnkaiahAnkaiah (Salesforce Developers) 
Hi Akansha,

Do you have relationship between case and custom object? If yes then which object is parent?

Thanks!!
rimenz joerimenz joe

We can now add metafields directly to Shopify objects like Product or ... The Shopify metafields allow you to add custom fields to any page or object in ...https://paystublogin.onl/
Akansha RanaAkansha Rana
Yes I have lookup relationship between both of them in which case is parent and RMA is child
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi Akansha,

Try with below code and modify the object & fields api names as per your org.
trigger rmaemailupdate on RMA__c (before update) {
    set<id> setcaseids = new set<id>();
    for(RMA__c rma: trigger.new){
	if(rma.Case__c !=Null){
        setcaseids.add(rma.Case__c); 
		}
    }

Map<id,Case> mappaccidwithvalues = new map<id,Case>();

for(Case cs:[select id,contactEmail from Case where id=:setcaseids]){
mappaccidwithvalues.put(cs.id,cs);

}

    for (RMA__c rma:trigger.new){
      if(mappaccidwithvalues.containskey(rma.Case__c)){
	  
	  rma.email__c = mappaccidwithvalues.get(rma.Case__c).contactEmail;
	  }

    }
 }

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​
Akansha RanaAkansha Rana
Hyy thanks for this but I want this condition to be completed through salesforce flow