> For the complete documentation index, see [llms.txt](https://doc.sysdevmobile.com/mss-extensibility/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.sysdevmobile.com/mss-extensibility/mss-5.1/myteam/entities-tab.md).

# Entities Tab

Exemplos práticos de payloads para a extensibilidade de tabs na **Ficha de Entidade** (módulo ENTD).

### Contexto

Quando o utilizador abre a ficha de uma entidade e clica num tab personalizado, o myTeam envia um POST ao URL configurado com o código da entidade no filtro `entityId`.

***

### Payload

```json
{
  "authentication": {
    "user": "admin",
    "hash": "a1b2c3d4e5f6..."
  },
  "filter": {
    "entityId": "CLI001"
  }
}
```

### Campos do Filtro

| Campo      | Tipo   | Descrição                                   |
| ---------- | ------ | ------------------------------------------- |
| `entityId` | string | Código da entidade aberta na ficha (CLICOD) |

***

### Exemplo de Resposta

O serviço externo deve devolver uma página HTML completa. Exemplo de uma ficha de identificação:

```html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style>
        body { font-family: sans-serif; margin: 16px; color: #333; }
        h3 { color: #2E7D32; margin-bottom: 16px; }
        table { width: 100%; border-collapse: collapse; }
        th, td { padding: 10px 12px; border: 1px solid #e0e0e0; text-align: left; }
        th { background: #f5f5f5; width: 200px; font-weight: 600; }
    </style>
</head>
<body>
    <h3>Identificação da Entidade</h3>
    <table>
        <tr><th>Código</th><td>CLI001</td></tr>
        <tr><th>Nome</th><td>Empresa Exemplo, Lda.</td></tr>
        <tr><th>NIF</th><td>123456789</td></tr>
        <tr><th>Morada</th><td>Rua da Amostra, 100</td></tr>
        <tr><th>Localidade</th><td>Lisboa</td></tr>
        <tr><th>Código Postal</th><td>1000-001</td></tr>
    </table>
</body>
</html>
```

### Fluxo

```
Utilizador abre ficha da entidade CLI001
    │
    ▼
Clica no tab personalizado
    │
    ▼
myTeam envia POST ao URL configurado
    │  payload: { authentication: {...}, filter: { entityId: "CLI001" } }
    ▼
Serviço externo valida autenticação
    │
    ▼
Consulta dados da entidade CLI001
    │
    ▼
Devolve HTML (status 200)
    │
    ▼
Conteúdo apresentado no iframe do tab
```

{% hint style="info" %}
O `entityId` corresponde ao campo `CLICOD` da tabela `STMSCLI`. O serviço externo pode utilizar este código para consultar qualquer informação relacionada com a entidade na base de dados do myTeam.O tab é carregado por lazy loading — o POST apenas é feito quando o utilizador clica no tab. Se a entidade mudar (navegação para outra ficha), o tab é recarregado com o novo `entityId`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.sysdevmobile.com/mss-extensibility/mss-5.1/myteam/entities-tab.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
