Creating a new deal with specific layout and pipeline
I am trying to create a button which creates a new deal for a particular account. It needs to be assigned a specific layout and pipeline. It seems like it should be really simple but I've been struggling to get this to work all day, can anyone help?!
- string button.CreateTradeOrderRemoval(String acctId,String UserId)
- {
- acctDetails = zoho.crm.getRecordById("Accounts",acctId);
- // map layout in case the id on its own is the problem.
- map_layout = Map();
- map_layout.put("name","Removals");
- map_layout.put("id", 345246000029262650);
- // map fields for new deal
- mp = Map();
- mp.put("Deal_Name","New Removal Order");
- mp.put("Layout",map_layout);
- mp.put("Pipeline","Removals Pipeline");
- mp.put("Order_Type","Trade Order");
- mp.put("Delivery_To","Cemetery Address");
- mp.put("Account_Name",ifnull(acctDetails.get("Account_Name"),""));
- mp.put("Owner",UserId);
- create = zoho.crm.createRecord("Potentials",mp);
- newpotid = create.get("id");
- return "You have successfully created a new Removal Order for this Trade Customer";
- }