dealResp = zoho.crm.getRecordById("Deals",deal_Id); if(dealResp != null) { Summary = dealResp.get("Deal_Name"); /* Fetch Account related information */ Account_Name = dealResp.get("Account_Name").toMap().get("name"); Encoded_Account_Name = zoho.encryption.urlEncode(Account_Name); response = invokeurl [ url :"https://fsm.zoho.com/fsm/v1/Companies/search?api_name=Company_Name&value=" + Encoded_Account_Name type :GET connection:"fsmconnection" ]; // ADD IF ELSE HERE response_data = response.get("data").toMap(); FSM_Account_id = response_data.get("id"); /* Fetch Contact related information */ Contact_Id = dealResp.get("Contact_Name").toMap().get("id"); Contact_Resp = zoho.crm.getRecordById("Contacts",Contact_Id); Contact_Email = Contact_Resp.get("Email"); responze = invokeurl [ url :"https://fsm.zoho.com/fsm/v1/Contacts/search?api_name=Email&value=" + Contact_Email type :GET connection:"fsmconnection" ]; // ADD IF ELSE HERE FSM_Contact_id = responze.get("data").toMap().get("id"); Billing_Address_resp = responze.get("data").toMap().get("Billing_Address"); if(Billing_Address_resp != null) { Billing_Address_resp = Billing_Address_resp.toMap(); bill_add_map = Map(); bill_add_map.put("id",Billing_Address_resp.get("id")); bill_add_map.put("Billing_City",Billing_Address_resp.get("City")); bill_add_map.put("Billing_Country",Billing_Address_resp.get("Country")); bill_add_map.put("Billing_Street_1",Billing_Address_resp.get("Street_1")); bill_add_map.put("Billing_State",Billing_Address_resp.get("State")); bill_add_map.put("Billing_Zip_Code",Billing_Address_resp.get("Zip_Code")); bill_add_map.put("Billing_Address_Name",Billing_Address_resp.get("Address_Name")); } Service_Address_resp = responze.get("data").toMap().get("Service_Address"); if(Service_Address_resp != null) { Service_Address_resp = Service_Address_resp.toMap(); ship_add_map = Map(); ship_add_map.put("id",Service_Address_resp.get("id")); ship_add_map.put("Service_Street_1",Service_Address_resp.get("Street_1")); ship_add_map.put("Service_State",Service_Address_resp.get("State")); ship_add_map.put("Service_Zip_Code",Service_Address_resp.get("Zip_Code")); ship_add_map.put("Service_City",Service_Address_resp.get("City")); ship_add_map.put("Service_Country",Service_Address_resp.get("Country")); ship_add_map.put("Service_Address_Name",Service_Address_resp.get("Address_Name")); } } terrResp = zoho.fsm.getRecords("Territories"); terrId = terrResp.get("data").toMap().get("id"); createMap = Map(); createMap.put("Summary",Summary); createMap.put("Contact",FSM_Contact_id); createMap.put("Company",FSM_Account_id); createMap.put("Service_Address",ship_add_map); createMap.put("Billing_Address",bill_add_map); createMap.put("Territory", terrId); create_resp = zoho.fsm.createRecord("Requests",createMap); reqId = create_resp.get("data").toMap().get("Requests").toMap().get("id"); reqId = reqId + ","; dealResp = zoho.crm.getRecordById("Potentials",deal_Id); fieldVal = dealResp.get("Request_IDs"); if(fieldVal != null) { reqId = reqId + fieldVal; } updateMap = Map(); updateMap.put("Request_IDs",reqId); updateResp = zoho.crm.updateRecord("Potentials",deal_Id,updateMap); return "Function executed successfully"; |
response = zoho.crm.getRecordById("Potentials",deal_Id); fieldVal = response.get("Request_IDs"); products = fieldVal; productList = products.toList(","); responseXML = ""; for each productListItem in productList { rowVal = 0; url = "https://fsm.zoho.com/home#/tab/Requests/" + productListItem; responseXML = responseXML + "<row cnt='" + rowVal + "'><FL val='Request ID' link=\"true\" url=\"" + url + "\">" + productListItem + "</FL></row>"; rowVal = rowVal + 1; } return responseXML; |
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
Write to us: support@zohoforms.com
Quick Links |
Workflow Automation |
Data Collection |
|
||
Form Templates |
||
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|