---
version: "2026.1.0"
language: "en"
---
# D365 Set Element Panel State

The **Set Element Expand/Collapse** block expands or collapses UI sections (for example, menus or accordions) in a **Dynamics 365 Finance \& Operations** application. It is automatically created when you interact with an expandable element during recording with the **D365 Fusion Recorder**. At runtime, the block enforces the chosen UI state so your flow can navigate consistently through sections whose fields depend on whether they are opened or closed.

This block works only in browser windows launched using the [Login](https://docs.leapwork.com/leapwork-flow/latest/building-blocks/dynamics-365/d365-login.md) block or within the current D365 recording session.

Fully expanded, the **D365 Set Element Expand/Collapse block**shows the following properties:  
![image-20260204-170724.png](https://docs.leapwork.com/__attachments/a_9fac5a5e12e269feecedbab404e3901fecc20d35418f30b59d9cb1f40902e70e/image-20260204-170724.png?cb=c3a40d5bad3cc1f2d7f7a2e657e07718)

**Note:** The screenshot on this page uses the **Elegance Design** , introduced in **2025.3**. If you are using an earlier version, your layout may look different.

## Quick-start

1. Use the **D365 Fusion Recorder** and expand or collapse a section in the D365 F\&O UI so the recorder generates the **Set Element Expand/Collapse** step.

2. Stop the recording, review and optionally adjust the generated step (for example, **State** and timeout-related settings), then save the recording so the full recorded flow is added to the canvas.

3. Run the flow when it's ready.

## Building block parameters

Parameters  
* **Block header** : The green input connector triggers the block when the automation flow reaches this step. The green output connector activates once the section has been expanded or collapsed successfully. The block title reflects the target element (for example, "Set Summary") and can be renamed by double-clicking the header text.

* **State** : Selects whether the target element should be **Expand** or **Collapse** . The recorded state is captured automatically during recording, but you can switch the option later to control the intended behavior at runtime.

* **Fail** : Triggers if the expand/collapse element cannot be located within the configured timeout behavior. Use it to branch the flow, retry, or take corrective action when the expected UI section is unavailable.

* **Source element** : Restricts the search for the expandable element to a specific parent container. This can increase accuracy when multiple expandable sections exist on the page. In Early Access versions, this field may be shown but not editable.

* **Browser window** : Specifies the browser instance where the action should be performed. In Early Access, only a single browser session is supported, so this setting is not configurable.

* **Default timeout** : Controls whether the block uses the default timeout from the flow settings or a custom timeout value.

* **Timeout (sec)** : Sets the maximum time the block waits for the expandable element to appear before triggering **Fail** . This field is used when **Default timeout** is not selected.

  **Note:** All cases have a **global timeout** configured in the **Settings** panel. This is unrelated to the timeout of a single building block. However, a running case will automatically be cancelled if it runs for longer than the global timeout.

## Resources

|                                                **Topic**                                                |                                                  **Description**                                                  |
|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [Flows FAQ](https://docs.leapwork.com/faq/latest/leapwork-flow-faq/flows-faq.md)                                                 | Common questions about creating, running, and managing flows in Leapwork.                                         |
| [Flows Troubleshooting](https://docs.leapwork.com/troubleshooting/latest/leapwork-flow-troubleshooting/flows-troubleshooting.md) | Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork. |
| [Fusion Recorder FAQ](https://docs.leapwork.com/faq/latest/leapwork-flow-faq/fusion-recorder-faq.md)                             | Frequently asked questions about Fusion Recorder                                                                  |