> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/fr/portail/portal-widgets/services.md).

# Services

## JavaScript

Le moteur d'exécution JavaScript est accessible via le service JavaScript. Il permet d'exécuter du JavaScript côté client et de retourner optionnellement une réponse.

```powershell
function OnClick {
    #Don't return a value    
    $JavaScript.InvokeVoid("alert('Hello!')")
    
    #Return a value
    $Value = $JavaScript.Invoke("'String'")
    $Message.Success($Value)
}
```

## Messages

Le service de messages est utilisé pour afficher des messages à l'utilisateur final. Il est basé sur `IMessageService`. Vous pouvez trouver plus d'informations [ici](https://antblazor.com/en-US/components/message#API).

```powershell
function OnClick {
   $Message.Success("Hello!")
}
```

## Notifications

Le service de notifications est utilisé pour afficher des messages contenant plus d'informations que le service de messages. Vous pouvez personnaliser le titre, le message et l'icône. Vous pouvez trouver plus d'informations [ici](https://antblazor.com/en-US/components/notification).

```powershell
function OnClick {
    $Config = [AntDesign.NotificationConfig]::new()
    $Config.Message = "Title" 
    $Config.Description = "This is the body of the notification"
    $Notification.Open($Config)
}
```

## Navigation

Le service de navigation peut être utilisé pour naviguer entre les pages du portail, les pages d'administration et les pages externes. Le service de navigation est une instance de [NavigationManager](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.navigationmanager?view=aspnetcore-8.0).

```powershell
function OnClick {
    $Navigation.NavigateTo("/portal/page/name")
}
```


---

# 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:

```
GET https://docs.devolutions.net/powershell-universal/fr/portail/portal-widgets/services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
