
void SendUpdate(Map request , Map organization , Map user){ //Get customer name customer = request.get("Contact"); custName = customer.get("name"); //Get customer email email = request.get("Email"); //Get request name reqName = request.get("Name"); //Send notification sendmail [ from :zoho.loginuserid to :email subject :"New Request" message :"Hi " + custName + "," + "<br>" + "A new Request " + reqName + " has been created for you." + "<br>" + "Thanks," + "<br>" + "Support Team" ] } |
To write the function that inserts a new record in the Requests module, do the following:
void CreateRequests(Map request , Map organization , Map user){ newRecordInfo = Map(); newRecordInfo.put("Summary","Sample"); newRecordInfo.put("Status","New"); newRecordInfo.put("Contact","1011000000141106"); newRecordInfo.put("Territory","1011000000139148"); serviceAddress = Map(); serviceAddress.put("id", "1011000000141109"); serviceAddress.put("Service_Street_1", "10 Oak St"); serviceAddress.put("Service_Street_2", null); serviceAddress.put("Service_City", "Oconee"); serviceAddress.put("Service_State", "Illinois"); serviceAddress.put("Service_Country", "United States"); serviceAddress.put("Service_Zip_Code", "62553"); serviceAddress.put("Service_Latitude", "39.287425"); serviceAddress.put("Service_Longitude", "-89.108759"); serviceAddress.put("Service_Address_Name", "Service Address"); billingAddress = Map(); billingAddress.put("id", "1011000000141108"); billingAddress.put("Billing_Street_1", "Locust St"); billingAddress.put("Billing_Street_2", null); billingAddress.put("Billing_City", "Oconee"); billingAddress.put("Billing_State", "Illinois"); billingAddress.put("Billing_Country", "United States"); billingAddress.put("Billing_Zip_Code", "62553"); billingAddress.put("Billing_Latitude", "39.286597"); billingAddress.put("Billing_Longitude", "-89.107787"); billingAddress.put("Billing_Address_Name", "Billing Address"); newRecordInfo.put("Service_Address", serviceAddress); newRecordInfo.put("Billing_Address", billingAddress); resp = zoho.fsm.createRecord("Requests", newRecordInfo); info resp; } |
To use this function, you need to associate this function with a workflow.
Scope | Description |
ZohoFSM.modules.custom.READ ZohoFSM.modules.contacts.READ ZohoFSM.modules.accounts.READ ZohoFSM.modules.Requests.READ ZohoFSM.modules.Estimates.READ ZohoFSM.modules.WorkOrders.READ | Used to retrieve records. Will be used in the following tasks: zoho.fsm.getRecords(<module>, <page>, <perPage>, <optionalDataMap>, <connection>); zoho.fsm.getRecordById(<module>, <id>, <optionalDataMap>, <connection>); zoho.fsm.getRelatedRecords(<relationName>, <parentModuleName>, <id>, <page>, <perPage>, <optionalDataMap>, <connection>); |
ZohoFSM.modules.custom.CREATE ZohoFSM.modules.contacts.CREATE ZohoFSM.modules.accounts.CREATE ZohoFSM.modules.Requests.CREATE ZohoFSM.modules.Estimates.CREATE ZohoFSM.modules.WorkOrders.CREATE | Used to create records. Will be used in the following tasks: zoho.fsm.createRecord(<module>, <dataMap>, <optionalDataMap>, <connection>); |
ZohoFSM.modules.custom.UPDATE ZohoFSM.modules.contacts.UPDATE ZohoFSM.modules.accounts.UPDATE ZohoFSM.modules.Requests.UPDATE ZohoFSM.modules.Estimates.UPDATE ZohoFSM.modules.WorkOrders.UPDATE | Used to edit records. Will be used in the following tasks: zoho.fsm.updateRecord(<module>, <id>, <dataMap>, <optionalDataMap>, <connection>); |
void CreateRequests(Map request , Map organization , Map user){ newRecordInfo = Map(); newRecordInfo.put("Summary","Sample"); newRecordInfo.put("Status","New"); newRecordInfo.put("Contact","1011000000141106"); newRecordInfo.put("Territory","1011000000139148"); serviceAddress = Map(); serviceAddress.put("id","1011000000141109"); serviceAddress.put("Service_Street_1","10 Oak St"); serviceAddress.put("Service_Street_2",null); serviceAddress.put("Service_City","Oconee"); serviceAddress.put("Service_State","Illinois"); serviceAddress.put("Service_Country","United States"); serviceAddress.put("Service_Zip_Code","62553"); serviceAddress.put("Service_Latitude","39.287425"); serviceAddress.put("Service_Longitude","-89.108759"); serviceAddress.put("Service_Address_Name","Service Address"); billingAddress = Map(); billingAddress.put("id","1011000000141108"); billingAddress.put("Billing_Street_1","Locust St"); billingAddress.put("Billing_Street_2",null); billingAddress.put("Billing_City","Oconee"); billingAddress.put("Billing_State","Illinois"); billingAddress.put("Billing_Country","United States"); billingAddress.put("Billing_Zip_Code","62553"); billingAddress.put("Billing_Latitude","39.286597"); billingAddress.put("Billing_Longitude","-89.107787"); billingAddress.put("Billing_Address_Name","Billing Address"); newRecordInfo.put("Service_Address",serviceAddress); newRecordInfo.put("Billing_Address",billingAddress); resp = zoho.fsm.createRecord("Requests", newRecordInfo, Map(), "fsmconnection"); info resp; } |
Method Used | Syntax |
Using the Internal Connection | <Response> = zoho.fsm.createRecord(<module>, <KEY-VALUE>); |
Using the Connection of a Service (Default/Custom) | <Response> = zoho.fsm.createRecord(<module>, <KEY-VALUE>, <optionalDataMap>, <connection>); |