advpl-mvc-avancado

Extend TOTVS Protheus MVC screens with child grids and PE *STRU hooks.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/JoniPraia/plugadvpl --skill advpl-mvc-avancado
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: advpl-mvc-avancado
Source: https://github.com/JoniPraia/plugadvpl/tree/main/skills/advpl-mvc-avancado
Command: npx skills add https://github.com/JoniPraia/plugadvpl --skill advpl-mvc-avancado

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill solves the problem of safely extending TOTVS Protheus MVC standard screens by injecting grids, triggers, validations, and behavior without corrupting the original routine.

Core Features & Use Cases

  • Add child grids to standard MVC screens via PE STRU: Customize routines (e.g., CNTA300, MATA070, MATA440, MATA460, FINA040) by adding a new grid tied to the existing master grid.
  • Cascading triggers with safe navigation: Recalculate values across parent/child grids using triggers, including required use of FWSaveRows/FWRestRows to prevent row-position bugs.
  • Preserve original validations: Extend validation logic by capturing and chaining existing bLinePost (so you don’t break TOTVS behavior).
  • Structured error messaging: Use SetErrorMessage to surface validation feedback in the standard MVC UI flow.
  • Integrate MATXFIS inside MVC triggers: Perform fiscal calculations inside MVC triggers while preventing context leakage by using MaFisEnd() and related MATXFIS lifecycle correctly.
  • Contextual behavior by status and call stack: Control editability using status blocks (e.g., SetOnlyView/SetOnlyQuery/SetNoInsertLine) and adjust validation based on FwIsInCallStack.

Quick Start

Use the advpl-mvc-avancado skill to add a custom child grid to a standard routine (such as CNTA300) using its corresponding *STRU Punto de Entrada, with cascaded triggers that recalculate child rows safely and preserve the original validation behavior.

Frequently Asked Questions about advpl-mvc-avancado

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a child grid to a standard TOTVS Protheus MVC screen?

You add a child grid to standard Protheus MVC screens by using the PE *STRU ponto de entrada to inject a new grid tied to the existing master grid without corrupting the original routine.

How do I preserve original MVC validations when extending Protheus standard screens?

To preserve original validations, capture and chain the existing bLinePost logic so your custom validation extends standard Protheus behavior without breaking the original TOTVS routine.

Why do cascading triggers cause row-position bugs in Protheus MVC grids?

Cascading triggers cause row-position bugs when navigating parent/child grids. Use FWSaveRows and FWRestRows to safely recalculate values across MVC grids and prevent row shifting.

Can I integrate MATXFIS fiscal calculations inside MVC triggers?

Yes, you can integrate MATXFIS inside MVC triggers for fiscal calculations, but you must manage the lifecycle correctly using MaFisEnd() to prevent context leakage across the Protheus routine.

How do I control MVC grid editability based on record status and call stack?

Control MVC grid editability by applying status blocks like SetOnlyView or SetNoInsertLine, and adjust validation logic dynamically based on FwIsInCallStack to handle contextual Protheus behavior.

What is the best way to surface validation errors in standard TOTVS MVC interfaces?

The best way to surface validation errors in TOTVS MVC is using structured SetErrorMessage usage, which pushes feedback directly into the standard MVC UI flow for user visibility.