Copy Email From Zoho Contacts to Zoho Sales Order

Copy Email From Zoho Contacts to Zoho Sales Order

In Zoho Contacts, I have email addresses already filled in, API name is "Email". I want to transfer this email field when a sales order is created. Name of email field in sales order is "Email"

I tried using this function

soDetails = zoho.crm.getRecordById("Sales_Orders",salesOrderId);
soAccountId = soDetails.get("Account_Name").get("id");
//Setup your fetch
accDetails = zoho.crm.getRecordById("Contacts",contactsId);
//Get Account_Email field from account (api name, setup>api names)
accEmail = accDetails.get("Email");
//Create Map for updating sales order
mp = Map();
//Set your new field update
mp.put("Email",accEmail);
//Update record
resp = zoho.crm.updateRecord("Sales_Orders",salesOrderId,mp);

but I get Failed to execute function
  • Value is empty and 'get' function cannot be applied Line Number:4
Can anyone help me with this code?