Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Automatic routines and unattended execution

Separates an automatic routine contract from its execution channel.

Automatic routines and unattended executionAdvPL
01 · OVERVIEW

Overview

Identify the supported routine and its fields, operation and array layout. Prepare identity/company/branch only if the caller does not supply them. MsExecAuto lMsErroAuto flags nonfatal errors; it does not catch every exception. lMsHelpAuto enables capture and lAutoErrNoFile controls default log-file generation. Unattended execution must not depend on MsgInfo or onscreen MostraErro: use documented error retrieval, minimize sensitive values and plan transactions/cleanup. The example initializes controls only, with no routine call or writes. (Sources: refs. 1–2.)

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed635()
    // PRIVATE identifiers required by the MsExecAuto contract.
    Private lMsErroAuto := .F.
    Private lMsHelpAuto := .T.
    Private lAutoErrNoFile := .T.
    // Reset lMsErroAuto immediately before the approved call.
    ConOut(ValType(lMsErroAuto))
Return Nil
Expected result

Prints L. No MsExecAuto execution or success claim occurs. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Do not invent a universal array for different routines. Test business failures, exceptions, concurrency and retries.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Variáveis de controle da MsExecAuto. Accessed on 2026-10-27.
  2. Atilio. dan-atilio/AdvPL. Exemplos/Vídeo Aulas/011 - Gravação de Registros via MsExecAuto/zExecAuto.prw. Arquivo completo consultado; adaptação editorial. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha