Skip to content

Instantly share code, notes, and snippets.

@louka1996
louka1996 / [Zoho Books] Zoho Deluge – Automatically Apply Late Fee and Email Invoice with PDF
Created May 2, 2025 17:34
This script calculates a late fee based on a custom percentage field, updates the invoice, and sends the customer an email with the updated invoice PDF attached.
// Fetch the late fee percentage from organization custom fields
OrgCustom_fieldsList = organization.get("custom_fields").toList();
for each custom_fields in OrgCustom_fieldsList
{
if (custom_fields.get("label") == "Frais de retard - Pourcentage")
{
PercentFee = custom_fields.get("value");
info PercentFee;
}
}
@louka1996
louka1996 / [Zoho CRM] Zoho Deluge – Address Autocomplete and Postal Code Fetch via Google Places API
Created May 2, 2025 17:31
Deluge function that integrates with the Google Places API to autocomplete addresses and retrieve postal codes based on place ID, designed for use in Zoho CRM.
string standalone.google_place_api1(String Address, String City, String place_id)
{
data = Map();
data.put("key", "YOUR_GOOGLE_API_KEY"); // Replace with connection or encrypted variable
data.put("language", "fr");
if (place_id == "")
{
urlApi = "https://maps.googleapis.com/maps/api/place/autocomplete/json";
data.put("input", Address + ", " + City + ", Canada");
@louka1996
louka1996 / [Zoho Books] Zoho Deluge – Sync Invoice Subtotal to Deal in Zoho CRM
Created May 2, 2025 17:27
Pushes the invoice subtotal from Zoho Books to the linked Deal in Zoho CRM.
// Get the associated CRM Deal ID and the invoice subtotal
invoiceDealId = invoice.get("zcrm_potential_id");
invoiceSubTotal = invoice.get("sub_total");
// Prepare the map to update the Deal
subtotal = Map();
subtotal.put("Amount", invoiceSubTotal);
// Retrieve the Deal details (optional if only updating)
dealDetails = zoho.crm.getRecordById("Deals", invoiceDealId);
@louka1996
louka1996 / [Zoho Books] Deluge Script – Disable PayPal on High-Value Retainer Invoices
Created May 2, 2025 17:22
A Deluge function that disables PayPal as a payment option on retainer invoices over $10,000 in Zoho Books.
// Retrieve the retainer invoice ID and organization ID
retainer_invoice_id = retainer_invoice.get("retainerinvoice_id");
retainer_invoice_total = retainer_invoice.get("total");
organization_id = organization.get("organization_id");
info "Invoice total: " + retainer_invoice_total;
// Check if the invoice total exceeds 10,000 before applying updates
if (retainer_invoice_total > 10000)
{
info "Invoice exceeds 10,000, updating payment options...";
@louka1996
louka1996 / [Zoho Books] Deluge Script – Match Invoice Line Items to Sales Order Lines with Logging
Last active May 2, 2025 17:19
Automatically matches each line item in a Zoho Books invoice with its corresponding Sales Order line item using item_id. Adds the salesorder_item_id to the invoice line items and updates the invoice. Includes logging for debugging and basic error checks for missing estimates or Sales Orders
organizationID = organization.get("organization_id");
estimate_id = invoice.get("estimate_id");
invoice_id = invoice.get("invoice_id");
updated_line_items = list();
if (estimate_id != null)
{
info "Start processing – Estimate ID: " + estimate_id;
estimate_details = zoho.books.getRecordsByID("estimates", organizationID, estimate_id, "booksfull");