| // Variables — no type declaration needed myString = “hello”; myNumber = 42; myDecimal = 3.14; myBoolean = true; myNull = null; // Comments — single line only // This is a comment // String concatenation fullName = firstName + ” ” + lastName; // Semicolons end each statement x = 10; y = x + 5; // Return a value from a function return myValue; // Logging (appears in execution log) info “Processing record: ” + recordId; |
|---|
| // Simple if if(score 50) { info “High score”; } // If / else if(status == “Active”) { // do something } else { // do something else } // If / else if / else if(amount >= 100000) { tier = “Gold”; } else if(amount >= 25000) { tier = “Silver”; } else { tier = “Bronze”; } // Comparison operators // == != < >= <= // Logical operators // && (and) ││ (or) ! (not) if(score 50 && industry == "Technology") { ... } |
|---|
| // For each loop (iterate a list) items = List(); items.add(“Apple”); items.add(“Banana”); for each item in items { info item; } // While loop counter = 0; while(counter < 10) { counter = counter + 1; } // Break out of a loop early for each item in items { if(item == "stop") { break; } } |
|---|
| // Create a map (key-value pairs) myMap = Map(); myMap.put(“name”, “Alice”); myMap.put(“score”, 95); // Read from a map name = myMap.get(“name”); // Check if a key exists if(myMap.containsKey(“score”)) { … } // Get all keys keys = myMap.keys(); // Remove a key myMap.remove(“score”); // Nested map (common in CRM record data) owner = deal.get(“Owner”); // returns a Map ownerId = owner.get(“id”); ownerName = owner.get(“name”); // Shorthand for nested get ownerId = deal.get(“Owner”).get(“id”); |
|---|
| // Create a list myList = List(); myList.add(“item1”); myList.add(“item2”); // Get list size count = myList.size(); // Get item by index (0-based) first = myList.get(0); // Check if list contains a value if(myList.contains(“item1”)) { … } // Remove an item myList.remove(“item1”); // Remove by index myList.remove(0); // Iterate a list for each item in myList { info item; } |
|---|
| // Length len = “hello”.length(); // 5 // Contains “hello world”.contains(“world”); // true // Starts / ends with “ABC-001”.startsWith(“ABC”); // true “report.pdf”.endsWith(“.pdf”); // true // To upper / lower case “Hello”.toUpperCase(); // “HELLO” “Hello”.toLowerCase(); // “hello” // Trim whitespace ” hello “.trim(); // “hello” // Replace “hello world”.replaceAll(“world”, “Zoho”); // “hello Zoho” // Split into a list parts = “a,b,c”.split(“,”); // [“a”,”b”,”c”] // Type conversions “42”.toLong(); // integer 42 “3.14”.toNumber(); // decimal 3.14 42.toString(); // “42” |
|---|
| // Current date and time today = zoho.currentdate; // date only now = zoho.currenttime; // datetime // Format a date as string today.toString(“yyyy-MM-dd”); // “2026-03-15” today.toString(“dd/MM/yyyy”); // “15/03/2026” // Parse a string to date myDate = “2026-03-15”.toDate(); // Date arithmetic tomorrow = today.addDay(1); nextWeek = today.addDay(7); lastMonth = today.addMonth(-1); // Days between two dates (positive = d2 after d1) days = date1.daysBetween(date2); // Extract components year = today.getYear(); // e.g. 2026 month = today.getMonth(); // 1–12 day = today.getDayOfMonth(); |
|---|
| // Get a single record by ID record = zoho.crm.getRecordById(“Deals”, dealId); // Search records with criteria // (max 200 per call — paginate for more) criteria = “(Stage:equals:Proposal Sent)”; records = zoho.crm.searchRecords(“Deals”, criteria, 1, 200); // Create a new record data = Map(); data.put(“Subject”, “Follow-up call”); data.put(“Due_Date”, “2026-04-01”); data.put(“Owner”, {“id”: ownerId}); zoho.crm.createRecord(“Tasks”, data); // Update an existing record updateData = Map(); updateData.put(“Stage”, “Closed Won”); zoho.crm.updateRecord(“Deals”, dealId, updateData); // Delete a record zoho.crm.deleteRecord(“Tasks”, taskId); // Get related records (e.g. contacts for an account) relatedRecords = zoho.crm.getRelatedRecords(“Contacts”, “Accounts”, accountId); |
|---|
| // GET request response = invokeurl [ url: “https://api.example.com/data?key=value” type: GET connection: “my_connection_name” ]; // POST request with JSON body params = Map(); params.put(“name”, “Alice”); params.put(“email”, “alice@example.com”); response = invokeurl [ url: “https://api.example.com/create” type: POST parameters: params.toString() connection: “my_connection_name” ]; // Read response status = response.get(“status”); data = response.get(“data”); |
|---|
For working examples combining these functions in complete scripts, see the 5 Deluge scripts guide and the custom functions guide. For structured Deluge learning from beginner to advanced, see the Deluge training programme.
| // Try / catch block try { result = zoho.crm.getRecordById(“Deals”, dealId); info “Success: ” + result.get(“Deal_Name”); } catch (e) { info “Error: ” + e.get(“message”); // Log to a custom Error Log module, send an alert email, etc. } // Null check before accessing nested data owner = record.get(“Owner”); if(owner != null) { ownerId = owner.get(“id”); } |
|---|
What data types does Zoho Deluge support?
How do I call a Zoho CRM API from a Deluge script?
What is the difference between input.get() and input.getAll() in Deluge?
Can I use this cheat sheet as a reference while writing Deluge scripts?
Where can I get help with a specific Deluge problem?