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

    • Du prompt à la production : comprendre le fonctionnement du MCP

      Le Model Context Protocol (MCP) est un protocole ouvert qui standardise la manière dont les applications se connectent aux modèles de langage (LLM). En termes simples, le MCP est le « USB-C des agents IA » : une interface universelle qui relie l’intelligence
    • Add Flexible Recurrence Options for Meeting Scheduling in Zoho Cliq (e.g., Every 2 Weeks)

      Hello Zoho Cliq Team, We hope you are doing well. Currently, when scheduling a meeting inside Zoho Cliq, the recurrence options are limited to Daily, Weekly, Monthly, and Yearly. There is no ability to set a meeting to occur every X weeks — for example,
    • filter on sheets mobile (iOS, iPadOS) does not work

      re-posting this as a question because reporting as a problem netted zero responses... I have this issue on every spreadsheet, whether imported or created natively in Zoho Sheets. I can use on desktop without issue: but on iOS the filter dropdowns are
    • Inactive License for free account.

      I recently upgraded my Cliq subscription not my team (on the free version), are unable to login to their accounts. The error message received is Inactive License Looks like you have not been covered under the current free plan of users. Please contact
    • zoho creator panel add formula

      Hello. I'm using zoho panels which works good for me but i need to add an extra calculation the predefined sum function provided by zoho. not sure if this is possible? The code zoho is generating for the sum is as follows; <text margin='0px' padding='0px'
    • Zoho Books recurring invoicing link to a Zoho CRM Deal?

      With the Zoho CRM Finance Integration setup, normally when creating an invoice via Zoho CRM Finance Integration on a Deal, it creates the invoice in Zoho Books with the CRM Deal *Potential link for that invoice. Alternatively, if you create the invoice
    • Data Import

      Hello Latha, Is there any option to enable data import option in Equipment module? Best regards, Chethiya.
    • No background for video recordings, no playback speed, can't even playback longer recordings - have to download…

      Hi. We utilize heavily video messages on Slack, but wanted to migrate to Cliq with Zoho One, however very basic yet very frequently used feature is missing: backgrounds for video recordings and playback speed. We were not happy with Slack's 5 minute limits
    • Introducing PDF conversion in Deluge

      Hello everyone, We're pleased to introduce built-in PDF conversion capabilities in Deluge with the launch of the convertToPDF task. As PDF is one of the most widely used formats in professional environments, this task helps streamline document generation
    • Changing naming convention for Estimates

      Hi there, How do I customise the naming of the filenames for estimates when sending them? Currently they are named literally just ES11.PDF or whatever the number of the estimate is. There is no Company name, description of the work, customer name, date
    • Email templates for estimates

      Hi there, When I send an estimate the option to choose a template appears. However it is common to need to make some minor personalizations and modifications to the email before sending ie. adding a second person to the greeting, or adding a small note
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • How to transfer uploaded files from Zoho Survey to external systems?

      Hi everyone, I'm currently integrating Zoho Survey with an external system and have run into a limitation I haven't been able to solve yet. I'm using webhooks to send submitted survey data (JSON) to my external API, which works perfectly for all standard
    • On Duty Requests - Zoho People Data

      Hello Team, We are currently using the On Duty Form to record Work From Home (WFH) requests in our organization. However, we are facing an issue where pending On Duty requests are not appearing in the Attendance Module. For example, if I submit On Duty
    • Editing Estimates

      Hi team, How do I delete line items in an estimate when editing it? I can't see any option to do this - no X, no trashcan, no drop down... And how do I revert to the original estimate after cloning? I cloned to see if the option to edit were disabled
    • Reading emails sent from Zoho

      Hi there, How do I view an email sent from Zoho, for example an email which contains an estimate? I can see there is a tab in the screen for that estimate which is labelled 'Emails' and I can see a summary of the email sent listed there, but I cannot
    • Feature Request: Mass update selected Contacts to Accounts

      I can't believe this isn't an ability already. It's a quick fix that would save hours of manual entry time. This looks like it had been requested 3-4 years ago with no answers from staff! Please add all contact fields into the "mass update" menu. You
    • Support Bots and Automations in External Channels

      Hello Zoho Cliq Team, How are you? We actively use Zoho Cliq for collaboration, including with our external developers. For this purpose, external channels are a key tool since they work seamlessly within the same interface as all of our other channels
    • How To Implement an Auto-Check-out Feature for Attendance?

      If an employee forgets to check out, the system should automatically check out the employee at 6:30 PM
    • Automate the file import step

      Hello everyone, I have a Sales - 'Account' category, and currently import the file to update it as follows: Import Accounts - From File - Update existing Accounts only - select and match the field the CRM. Since we have been using Microsoft 365 SharePoint.
    • Set Default Status of Assembly to "Assembled" When Entered in UI

      I've just discovered the new "confirmed" status of Assemblies within Inventory. While I understand the intent of this (allowing for manufacturing planning and raw material stock allocation), it was initially confusing to me when manually entering some
    • Sender Email Configuration Error.

      Hello Team, Hope you are all doing well. We are in the process of creating the Zoho FSM environment in the UAE. When we try to add the sender email address “techsupportuae@stryker.com”, we receive the error message: “Error occurred while sending mail
    • Share saved filters between others

      Hi, I am in charge to setup all zoho system in our company. I am preparing saved filters for everybody, but the only one can see its me. How can others see it? Thanks
    • Webinar Alert: Learn how to decode your landing page performance with analytics

      Every click, scroll, and drop-off tells a story. Are you listening? Join our Landing Page Analytics webinar to understand how data can reveal what’s working and what’s costing you conversions. In this session, you'll discover The most important metrics
    • Campaign Status Field in CRM

      I'm wanting to create a custom view in CRM that shows all those who have recently hard bounced in past campaigns so we can clean up the database. An old Zoho article said it was possible, but I don't see the option to push campaign status field to CRM,
    • Zoho Forms for Vertical Studio Subscriber Organizations

      We’re excited to introduce the Zoho Forms integration with Vertical Studio. This allows you to capture data using forms and send it directly to your Vertical Studio modules. With this integration, form submissions can be used to create or update records,
    • Zoho Flow not handling Boolean properly

      Hi, I have a checkbox in one system that I'm trying to sync with a checkbox in Zoho CRM. The value from the source system comes in as blank (unticked) or 1 (ticked). I've written the following custom function to convert the output to either boolean false
    • Printing invoice from creator using writer

      Hello. I have created my invoices using Zoho Writer and i'm sending data to them from Zoho Creator by selecting a row in a report and then clicking a button which has workflow connected to it to send the date to the invoice in writer. This is working
    • How to Initiate WhatsApp Message on SalesIQ?

      I've just activated a Business WhatsApp phone number through SalesIQ because of its touted omnichannel chat approach. Sounds exciting. I understand that when a customer sends me a WA message, I can reply to it on SalesIQ and keep the chat going, perfect.
    • i want to delete organization or tranfer ownership

      I accidentally created a Zoho organisation and now I cannot accept an invite from another organisation. I am the Super Admin and cannot leave. Please either delete my organisation or transfer ownership so I can leave.
    • Bulk upload images and specifications to products

      Hi, Many users have asked this over the years and I am also asking the same. Is there any way in which we can bulk upload product (variant) images and product specifications. The current way to upload/select image for every variant is too cumbersome.
    • CRM Notes

      Hello, We want to add a Note to the Contact record when a Note is added to a Case or Deal. I wasn't able to do this using a workflow, so I tried using Zoho Flow, but that didn't work either. Does anyone have a suggestion on how we can accomplish thi
    • Zoho FSM API Delete Record

      Hi FSM Team, It would be great if you could delete a record via API. Thank you,
    • Marketing Tip #26: Optimize product images for SEO

      Product images can do more than make your store look good. They can also help customers discover your products through search. Since search engines can’t "see" images, they rely on text signals to understand what an image is about. Two small actions make
    • Allow rejected records (Approval process) to re-enter Blueprints

      Cannot seem to get my head around the key differences between the Blueprints and the Approval Process. For me it seems like different flavours of more or less the same thing - especially now that we have the option of Record Locking. Have a quote to sales
    • Every time an event is updated, all participants receive an update email. How can I deactivate this?

      Every time an event is updated in Zoho CRM (e.g. change description, link to Lead) every participant of this meeting gets an update email. Another customer noticed this problem years ago in the Japanese community: https://help.zoho.com/portal/ja/community/topic/any-time-an-event-is-updated-on-zohocrm-calendar-it-sends-multiple-invites-to-the-participants-how-do-i-stop-that-from-happening
    • Streamlining E-commerce Photography with AI Background Tools

      Hey Zoho Community, I’ve been messing around with ways to make product images less of a headache for fashion brands on Zoho Commerce. You know how boring generic backdrops can get, and how much time traditional photoshoots eat up, right? I tried out this
    • Add @Mention Notifications in Zoho Cliq for Zoho Project Mentions

      Hello Zoho Projects Team, We hope you are doing well. We would like to submit a feature request regarding "Projects Bot" Cliq bot notifications for @mentions inside Zoho Projects comments (Tasks and Issues). Current Behavior: At the moment, when someone
    • WO Completion Status Not Updating Automatically

      Hello Latha, Hope you are doing well. Over the past few days, we have been facing an issue with WO completion. When an AP is marked as complete, the work order status is not automatically updating to “Completed,” and we have to mark it manually. Could
    • Is it possible to create a meeting in Zoho Crm which automatically creates a Google Meet link?

      We are using Google's own "Zoho CRM for Google" integration and also Zoho's "Google Apps Sync" tools, but none of them provide us with the ability to create a meeting in Zoho CRM that then adds a Google Meet link into the meeting. Is this something that
    • Next Page