Boas práticas de desenvolvimento em Deluge

Boas práticas de desenvolvimento em Deluge

O Deluge (Data Enriched Language for the Universal Grid Environment) é a linguagem de script utilizada em diversas aplicações do ecossistema Zoho, como Zoho Creator, Zoho CRM, Zoho Books e Zoho Flow. Ela foi projetada para permitir automações rápidas e integrações entre sistemas sem a complexidade de linguagens tradicionais.

Em projetos empresariais, especialmente quando o Zoho Creator é utilizado como plataforma de desenvolvimento de aplicações corporativas, a forma como o Deluge é estruturado pode impactar diretamente na manutenção, escalabilidade e performance da solução.

Este artigo apresenta boas práticas fundamentais para o desenvolvimento em Deluge em ambientes corporativos, com foco em automação empresarial.


1. Estruture o código com foco em reutilização  

Um erro comum em projetos iniciais é criar scripts longos e repetitivos dentro de workflows, buttons e automações.

A boa prática é centralizar lógicas em funções reutilizáveis.

Exemplo incorreto:

Código duplicado em vários workflows:

if(input.Status == "Aprovado")
{
    input.Data_Aprovacao = zoho.currentdate;
    input.Usuario_Aprovacao = zoho.loginuser;
}

Boa prática  

Criar uma função reutilizável.

Vamos imaginar que o nome do Formulário onde contém os dados é DemoForm. Isso é um exemplo para executar em workflow de Evento de Registro somente Editado e não Criado.

function a ser criada:

 

void registrarAprovacao(int regID)
{

registro = DemoForm[ID == input.regID];
     registro.Data_Aprovacao = zoho.currentdate;
     registro.Usuario_Aprovacao = zoho.loginuser;
}

Uso no Workflow do DemoForm:

if(input.Status == "Aprovado")
{
    thisapp.registrarAprovacao(input.ID);
}

Benefícios  

  • Redução de duplicidade

  • Código mais limpo

  • Facilidade de manutenção

  • Maior padronização


2. Utilize nomenclatura padronizada  

Projetos corporativos podem ter centenas de formulários, workflows e funções. Sem padronização, o código se torna difícil de entender.

Recomendação de padrão  

Funções

fn_nomeDaFuncao

Exemplo:

fn_calcularImposto
fn_criarPedidoVenda
fn_sincronizarCRM

Variáveis

camelCase

Exemplo:

valorTotal
dataEntrega
clienteId

Listas

listaClientes
listaPedidos

Mapas

mapCliente
mapPedido

Essa padronização melhora muito a legibilidade do projeto.


3. Separe lógica de negócio da interface  

Em aplicações empresariais, é importante evitar colocar toda a lógica diretamente em:

  • On Validate

  • On Success

  • On Update

A lógica deve ser separada em funções de serviço.

Estrutura recomendada  

Workflows
   ↓
Funções de serviço
   ↓
Integrações / regras de negócio

Exemplo  

Workflow:

fn_processarPedido(input.ID);

Função:

void fn_processarPedido(pedidoId)
{
    pedido = Pedidos[ID == pedidoId];

    pedido.Status = "Processado";
    pedido.Data_Processamento = zoho.currentdate;
}

Essa separação facilita:

  • manutenção

  • testes

  • reaproveitamento de lógica


4. Evite loops desnecessários  

Loops mal estruturados podem causar problemas de performance, especialmente em aplicações com grande volume de dados.

Problema comum  

for each cliente in Clientes
{
    if(cliente.ID == clienteId)
    {
        info cliente.Nome;
    }
}

Boa prática  

Utilizar busca direta

cliente = Clientes[ID == clienteId];
info cliente.Nome;

Isso reduz drasticamente o consumo de recursos.


5. Controle de erros (Error Handling)  

Em automações empresariais, erros não tratados podem quebrar processos importantes.

Sempre que possível utilize try-catch.

Exemplo  

try
{
    response = invokeurl
    [
        url :"https://api.externa.com/pedido"
        type :POST
        parameters : mapPedido
    ];
}
catch(e)
{
    info "Erro na integração: " + e;
}

Boa prática adicional:

Criar logs de erro em um formulário.

Log_Erros

Campos:

  • Data

  • Usuário

  • Processo

  • Mensagem

Isso ajuda muito na governança da aplicação.


6. Use mapas e listas corretamente  

Deluge trabalha muito com List e Map.

Exemplo de Map  

mapCliente = Map();
mapCliente.put("Nome","Empresa ABC");
mapCliente.put("CNPJ","00.000.000/0001-00");

Exemplo de List  

listaProdutos = List();
listaProdutos.add("Notebook");
listaProdutos.add("Monitor");

Uso em integração  

parametros = Map();
parametros.put("cliente",mapCliente);
parametros.put("produtos",listaProdutos);

Essa estrutura é fundamental para integrações via API.


7. Otimize chamadas de API  

Integrações são comuns em projetos empresariais.

Evite:

  • chamadas repetidas

  • chamadas dentro de loops

  • múltiplas requisições desnecessárias

Problema  

for each pedido in listaPedidos
{
    invokeurl ...
}

Melhor abordagem  

Agrupar dados e enviar em lote quando possível.


8. Documente suas funções  

Projetos corporativos costumam durar anos.
Documentar o código é essencial.

Exemplo  

/*
Função: fn_calcularComissao

Descrição:
Calcula a comissão do vendedor com base no valor do pedido.

Parâmetros:
pedidoId (int)

Retorno:
decimal
*/

Isso ajuda:

  • novos desenvolvedores

  • auditorias

  • manutenção futura


9. Evite lógica excessiva em um único script  

Scripts muito grandes são difíceis de manter.

Regra prática:

Se um script tiver mais de 50–80 linhas, considere dividir em funções menores.

Isso melhora:

  • leitura

  • debugging

  • reutilização


10. Pense em arquitetura desde o início  

Em projetos grandes de Zoho Creator, o Deluge deve ser usado dentro de uma arquitetura bem definida.

Uma arquitetura comum é:

Interface (Forms / Pages)
        ↓
Workflows
        ↓
Funções de serviço
        ↓
Integrações / APIs
       

Essa abordagem segue princípios semelhantes a arquiteturas corporativas modernas, garantindo maior escalabilidade.


Conclusão  

O Deluge é uma linguagem extremamente poderosa para automação empresarial dentro do ecossistema Zoho. No entanto, seu verdadeiro potencial só é alcançado quando o desenvolvimento segue boas práticas de arquitetura, organização e performance.

Ao aplicar princípios como:

  • reutilização de código;

  • padronização de nomenclatura;

  • separação de responsabilidades;

  • tratamento de erros;

  • otimização de integrações;

é possível construir aplicações corporativas robustas, escaláveis e fáceis de manter.

Em projetos empresariais de médio e grande porte, essas práticas transformam o Zoho Creator de uma simples plataforma de automação em uma plataforma completa de desenvolvimento de aplicações de negócio.


      • Sticky Posts

      • Participe dos encontros exclusivos Zoho User Groups (ZUGs)

        Temos um convite especial para você! Participe dos Zoho User Groups (ZUGs), encontros presenciais que conectam usuários, especialistas e parceiros da Zoho. Esses eventos são a oportunidade perfeita para compartilhar melhores práticas e descobrir como
      • Boas Práticas na Comunidade Zoho Brasil

        Participar da Comunidade Zoho Brasil pode ser uma experiência enriquecedora e colaborativa, mas para que isso aconteça, devemos sempre contribuir para um ambiente positivo e construtivo. Aqui estão algumas dicas de boas práticas para garantir que todos
      • Seja muito bem-vindo à Comunidade Zoho Brasil!

        É com muita empolgação que convidamos você a fazer parte deste novo espaço de colaboração, interação e troca de conhecimentos! Na Comunidade Zoho Brasil você poderá criar tópicos de conversa nos fóruns e também colaborar em discussões produtivas iniciadas
      • A assistente de redação inteligente do Zoho Writer, Zia, agora oferece suporte ao português brasileiro!

        Obtenha sugestões contextuais de ortografia e gramática e melhore a qualidade geral do seu conteúdo com a Zia ao escrever em português. Estamos treinando a Zia em um novo idioma para atender à crescente demanda dos nossos usuários por acesso multilíngue.

        • Recent Topics

        • Using API for multiple organizations

          I am busy building an app to load data from a retailer into Zoho Books. We are planning on selling the app to multiple organizations that use this retailer. Is there a way to get a single oauth app to access multiple organizations? From what I can find
        • MacOS agent 2026_M04 release notes

          Agent Version: 3.120.0 Release date: 23 April, 2026 Retry mechanism for end users to enable Accessibility and Screen Share permissions to successfully join remote sessions. Agent stickiness on multiple desktops to avoid confusion. Improvements to audio
        • MacOS agent 2026_M03 release notes

          Agent Version: 3.117.0 Release date: 02 March, 2026 Bug fixes and performance improvements for optimised session experience.
        • MacOS agent 2026_M02 release notes

          Agent Version: 3.116.0 Release date: 23 February, 2026 Major enhancement: File Manager feature release Minor enhancement: Improved peer to peer connectivity across various network conditions. Minor enhancement: Improvements to Elevate to Admin mode
        • MacOS agent 2026_M01 release notes

          Agent Version: 3.111.0 Release date: 11 February, 2026 Major Enhancement: Quick Support feature release. Upgrades to monitoring protocols for analysing performance. Issue fixing of idle session timing interfering with backend activities.
        • Account Unblock Request

          Dear Sir/Madam, I hope you are doing well. I noticed that my account has been blocked for violation of the usage policy which I believe comes from it being associated with sending spam. I have since then removed the old keys which were compromised in
        • Kaizen #242 Enabling In-Context Order Creation from Deals Using SlyteUI

          Hello everyone! Welcome to another interesting Kaizen post. Today’s spotlight is on SlyteUI, the new UI builder designed to create powerful, intuitive user interfaces in minutes. Built for speed and simplicity, SlyteUI empowers teams to deliver high-impact
        • Auto-sync field of lookup value

          This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
        • CRM gets location smart with the all new Map View: visualize records, locate records within any radius, and more

          Hello all, We've introduced a new way to work with location data in Zoho CRM: the Map View. Instead of scrolling through endless lists, your records now appear as pins on a map. Built on top of the all-new address field and powered by Mappls (MapMyIndia),
        • Can't access google from toppings menu

          So... When I click the manage button in toppings, nothing happens. it won't let me access the settings.
        • Best sales insights for target accounts?

          Question for all the sales power-users out there: I would like to gain insights from Zoho CRM for a rotating list of target accounts. Each Outside Salesperson has 5 target accounts, and they can change these targets quarterly with management approval.
        • Emails Disappearing From Inbox

          I am experiencing the unnerving problem of having some of the messages in my inbox just disappear.  It seems to happen to messages that have been in there for longer than a certain amount of time (not sure how long exactly). They are usually messages that I have flagged and know I need to act on, but have not gotten around to doing so yet.  I leave them in my inbox so I will see them and be reminded that I still need to do something about them, but at least twice now I have opened my inbox and found
        • Cadence not stopping on reply (in some cases) – anyone else?

          Hi everyone, we’ve noticed that in a few cases, Cadences don’t stop even though the contact replied (setting “stop on reply” is active). It works fine most of the time, but occasionally the reply is visible in CRM without stopping the Cadence. Our assumption
        • Issue with Resume Parsing and Storage Limit in Zoho Recruit

          Hello Team, We are currently facing an issue with resume parsing in Zoho Recruit. While parsing resumes, we are receiving a message indicating that the storage is full. We would like to delete multiple old resumes from the system to free up storage space.
        • BUG: Related List Buttons with Client Script action now erroring

          There appears to have been a bug introduced over the last few days with Related List buttons that invoke a Client Script action. Button configuration: Configured Client Script: Results: The default loader is presented at the top of the page, and an error
        • SalesIQ Email Delivery Issues to Microsoft

          Is anyone else having delivery issues to Hotmail, Outlook, and Live inboxes when sending transcripts and replies via email from SalesIQ? We’ve detected that emails sent from SalesIQ to these accounts aren't arriving—they don’t even bounce back; they simply
        • Introducing the revamped What's New page

          Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
        • Multiple Pipelines

          Is it possible to create multiple candidate pipelines?
        • Insert Template not inserting

          I have been using the "Insert Template" feature for years and I use it every single working day. Yesterday it was working fine. Today, on two different browsers (Chrome and Edge), I can select "Insert Template", select the template I want to insert, but
        • Default ticket template in helpcenter

          Hello, I have a web form and a ticket template created. How can I make that my default ticket template? If an user clicks New ticket or create a ticket, I want that template to be the default one. Thank you for the time and info.
        • Zoho Books bill pay option not available with zoho one

          Why isn't Zoho Books bill pay add-on not available for Zoho one customers not even as a purchasable option. I think this is very inconvenient for companies wanting to use this feature all in one system
        • Access images from form submission in power automate

          Images from form submission show up as links in power automate. How do I access the image data?
        • Add personal Facebook to Zoho Social

          Hi. is there any way i can post to my business and personal Facebook and Instagram at the same time when I make or schedule a post?
        • Need help to evaluate if Commerce is good for me

          Hi, I just want to quickly check if Zoho Commerce can fulfill my needs. Here is what I am looking for: - Multi-vendor plateform : We will be 3-4 different farms that will offer similar products (ex. tomatoes) to few selected customers (retaurants). All
        • Smart Feature Compatibility Indicators for CRM Field

          Zoho CRM offers a wide range of field types and advanced customization options. However, several field types have feature-specific limitations that are currently documented only in help articles. For example, while configuring a Rich Text field, admins
        • Ask the Experts: A Live Q&A Session

          Session Closed We've locked this post as the session has ended. We'll see you again in the next session! We’re back with another exciting edition of the Ask the Experts series, this time exclusively for our Zoho Recruit users from the USA & Canada regions!
        • T&C acceptance gate before estimate Accept, with audit trail

          We had to settle a Florida small-claims case in 2025 because we couldn't prove our customer was bound to the venue clause in our Terms & Conditions. The estimate footer mentioned the T&Cs, and Zoho Books logged the customer's IP and timestamp when they
        • Contract to payment flow

          Hi everyone, I’m trying to set up a contract-to-payment flow and want to avoid duplicating invoices or customers in Zoho Books. The flow should be: contract generated from CRM, sent via Zoho Sign, client signs, deposit is paid, and the invoice should
        • Zoho Books | Product updates | May 2026

          Hello users, We're back with the latest updates and enhancements we've rolled out in Zoho Books. From sales tax automation to scanning receipts for free, explore the updates designed to upgrade your bookkeeping experience. Sales Tax Automation [US & Canada
        • Show backordered items on packing slip

          Is it possible to show a column on the Packing Slip that shows number of backordered items when a PO is only partially filled? I would also like to see the Backordered column appear on POs after you receive items if you didn't get ALL of the items or partial amounts of items. And lastly, it would be nice to have the option of turning on the Backordered column for invoices if you only invoice for a partial order. -Tom
        • Many Zoho POS Issues

          Can not apply credits from a customers account as a form of payment. It shows that you can but there is a bug that does not execute the action. Reported many times. Can not view Sessions from Zoho POS WebView, throws a JQUERY error Workflows and actions
        • Control Fields on Mobile App

          On the mobile app, how do we control which fields appear on the screen for records that have a related list? In the example below I want the Inspection Stage and Inspection Type fields to appear, not the record owner (Dev Admin). I changed the Inspections
        • 预期结果 实际结果 "zmverify.zoho.com" "zmverify.zoho.com."

          My domain is tenmokucup.com, I have a TXT record, but verification failed,Please help me, my TXT record is "zoho-verification=zb03390953.zmverify.zoho.com", I have added to DNS. You can confirm it. 预期结果 实际结果 "zmverify.zoho.com" "zmverify.zoho.com."
        • Adding options in the salutation drop down list (Books)

          Hello,  I am a new user still in the trial phase so I apologize if I have missed this. I did search the knowledge base and community first. I need to add a "Mr and Mrs" option in the salutation drop down options in Books. I have tried to find the edit
        • How to make the birthday date field available without the year?

          Hello, I wonder if I can have the date of birthday field without the year. A lot of people dont like to say the year they were born. 
        • Google Drive shared folder

          My deluge script has stopped working, no longer collecting files from Google Drive - have these connections finally been deprecated ?? They seem to be active but errors occur when updating them ?
        • Issue adding/changing mobile number for OTP

          Hi Zoho Community, I’m trying to add or change my mobile number, but I keep getting this error: “We’re unable to send OTP to this mobile number. Please contact support-as@eu.zohocorp.com” Because of this, I can’t verify my number or continue the setup.
        • Journal Entries Do Not Show Multiple Entries to the Same Account

          Another basic accounting function that Books ... Accountants sometimes write journal entries, debiting and/or crediting the same account in the same entry. This is due to the need to record specific activity in an account when we pull reports especially
        • How to setup pricing in Zoho

          Hi everyone, I am relatively new here and have just moved from my old inventory system to the Zoho one. I am trying to get my head around how it all works. I am mostly setup connected to a shopify store, but I do manual sales also For manual invoicing,
        • Work Orders / Bundle Requests

          Zoho Inventory needs a work order / bundle request system. This record would be analogous to a purchase order in the purchasing workflow or a sales order in the sales cycle. It would be non-journaling, but it would reserve the appropriate inventory of
        • Next Page