IdentifierExact entry-point name stated in the routine documentation.
AdvPL GuideConcepts, contract and best practicesLearn about conventional and MVC entry points for extending standard Protheus routines without changing the original source code.
An entry point is an extension provided by TOTVS at a specific moment in a routine. In the conventional model, the User Function runs at the documented event. In MVC, one User Function associated with the model identifier can run at several lifecycle hooks. In both cases, the purpose is to adapt a business process without changing the standard source code.
Concepts, contract and best practicesIdentifierExact entry-point name stated in the routine documentation.
PARAMIXBAvailable only when the documented entry point provides it; its structure varies by routine and release.
Return valueSome entry points require a return value and others return Nil. Confirm its type and effect in the specific documentation.
A safe extension: respect the parameter and return-value contract defined for the selected entry point.
#Include "TOTVS.ch"
/*
Replace EXAMPLEEP with the identifier documented in TDN.
Check parameters and return value before implementing.
*/
User Function EXAMPLEEP()
Local lContinue := .T.
// Apply only the business rule intended for this event.
Return lContinueTeaching model. The .T. return is only illustrative and must not be copied without consulting the actual entry-point contract.
#Include "TOTVS.ch"
#Include "FWMVCDEF.ch"
/* The name must match the documented Model ID. */
User Function MYMODEL()
Local aParam := PARAMIXB
Local xRet := .T.
Local cHookId := ""
If aParam <> Nil
cHookId := aParam[2]
Do Case
Case cHookId == "MODELPOS"
// Global model validation.
Case cHookId == "MODELCOMMITTTS"
// In-transaction action: keep it safe and brief.
EndCase
EndIf
Return xRetTeaching example. Confirm the Model ID, PARAMIXB structure, accepted hooks and return value in the TDN for the routine.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use