Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Entry points in MVC routines

PARAMIXB = {oObject,cEvent,cForm,...}

Dispatches received event IDs with event-specific returns.

Entry points in MVC routinesAdvPL
01 · OVERVIEW

Overview

The standard MVC entry point is a User Function named after the Model ID and receives an array: object [1], event [2] and form/submodel [3]. Extra arguments vary by event. MODELPOS needs logical; BUTTONBAR needs a structured array. MODELCOMMITTTS runs after full persistence inside the transaction; MODELCOMMITNTTS after persistence outside it, with no expected return. TOTVS notes MODELPOS can run for validation and the model event: do not assume a single call. The community sample demonstrates dispatch but its commit description differs from the official table; the latter is authoritative. (Sources: refs. 1–3.)

02 · SYNTAX

Syntax

PARAMIXB = {oObject,cEvent,cForm,...}
03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed573()
    Local aEnvelope := {Nil,"MODELPOS","EDMASTER"}
    // Synthetic envelope: not a universal entry-point implementation.
    If Len(aEnvelope) >= 3
        If ValType(aEnvelope[2]) == "C"
            ConOut(aEnvelope[2])
        EndIf
    EndIf
Return Nil
Expected result

Prints MODELPOS. Neither validates a real model nor commits. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Handle every event requiring a return and check extra positions before reading. Do not infer a grid solely from Len > 3. Keep validation free of external side effects and make integrations idempotent.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Ponto de Entrada Padrão do MVC. Accessed on 2026-10-27.
  2. TOTVS. MODELPOS executa duas vezes. Central de Atendimento, 2024. Accessed on 2026-10-27.
  3. Atilio. MATA070_pe.prw; exemplo comunitário, commit 7d275a7. 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