Populate Contact from Account via Function

Populate Contact from Account via Function

Hi,

we do have a field in "Accounts" that should populate a field with the same name in eacht associated contact.

As Zoho doesn't offer that integrated (why???) we have to do it via functions. So here is my function:

rec = zoho.crm.getRecordById("Accounts",accId);
resp = zoho.crm.getRelatedRecords("Contacts","Accounts",accId,1);
for each  ele in resp
{
mp = Map();
mp.put("Unternehmen Type",ifnull(rec.get("Unternehmen Type"),""));
updateResp = zoho.crm.updateRecord("Contacts",ele.get("id"),mp);
info updateResp;
}

In the arguments, accId = Account ID

Why does the function do not work?

I have to make many more, even to custom modules. Is there any other way?