How to create a button in Accounts to create a new estimate with Zoho Finance suite

How to create a button in Accounts to create a new estimate with Zoho Finance suite

Hello,

I'm trying to create a button in Zoho CRM Accounts module, so our sales can directly create a new estimate regarding this account.
I've tried to follow these steps and make it work for the accounts module which is supposed to be easier :
I've put the following code in a custom function but couldn't make it work properly :
Hope to get some help here 

Thanks a lot 
Argument
cid = string
cid = accounts / account ID

Code :
accountinfo = zoho.crm.getRecordById("Accounts",cid.toLong());
relatedaccount = zoho.crm.getRelatedRecords("id","Accounts",cid.toLong(),1);
info = "id";
acctid = ifnull(accountinfo.get("Account_Name"),"").get("id");
info = acctid;
customerid = zoho.books.getRecords("Contacts","XXXX","zcrm_account_id=" + acctid).get("contacts").get(0).get("contact_id");
mp = Map();
mp.put("customer_id",customerid);
mp.put("date",today);
mp.put("zcrm_potential_id",cid);
create = zoho.books.createRecord("Estimates","XXXX",mp);
info create;
return "success";

where XXXX is my org ID