Function to create new deal based on existing deal

Function to create new deal based on existing deal

I want to create a new deal based on a existing deal

i have the following code and its working, but how can i relate that deal to the original contact record of the original deal so the new deal will be related to the contact?

  1. deal_info = zoho.crm.getRecordById("Deals",deal_id);
  2. //
  3. // get information about the deal
  4. deal_name = deal_info.get("Deal_Name");
  5. deal_name = deal_info.get("Contact_Name");
  6. //deal_estimator = deal_info.get("Estimator").get("id");
  7. //deal_type = deal_info.get("Type");
  8. closing_date = deal_info.get("Closing_Date");
  9. //
  10. //create the record name
  11. new_deal = "Job: " + deal_name;
  12. //
  13. //map fields from the deal to the job
  14. mp = Map();
  15. //mp.put("Type",deal_type);
  16. //mp.put("Estimator",deal_estimator);
  17. mp.put("Closing_Date",closing_date);
  18. mp.put("Deal_Name",new_deal);
  19. mp.put("Deal_Related",deal_id);
  20. //
  21. //create the job
  22. create_new_deal = zoho.crm.createRecord("Deals",mp);
  23. info create_new_deal;