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?
- deal_info = zoho.crm.getRecordById("Deals",deal_id);
- //
- // get information about the deal
- deal_name = deal_info.get("Deal_Name");
- deal_name = deal_info.get("Contact_Name");
- //deal_estimator = deal_info.get("Estimator").get("id");
- //deal_type = deal_info.get("Type");
- closing_date = deal_info.get("Closing_Date");
- //
- //create the record name
- new_deal = "Job: " + deal_name;
- //
- //map fields from the deal to the job
- mp = Map();
- //mp.put("Type",deal_type);
- //mp.put("Estimator",deal_estimator);
- mp.put("Closing_Date",closing_date);
- mp.put("Deal_Name",new_deal);
- mp.put("Deal_Related",deal_id);
- //
- //create the job
- create_new_deal = zoho.crm.createRecord("Deals",mp);
- info create_new_deal;