# How to use code to collapse the selected l layer group in uxp?

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-use-code-to-collapse-the-selected-l-layer-group-in-uxp/2591>\
**Category:** Photoshop\
**Tags:** uxp, javascript\
**Created:** [February 25, 2021, 12:26pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-use-code-to-collapse-the-selected-l-layer-group-in-uxp/2591 "2021-02-25T12:26:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Pierre\_G](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/pierre_g/32/971_2.png) [@Pierre\_G](https://forums.creativeclouddeveloper.com/u/Pierre_G)\
**Post date:** [February 25, 2021, 12:45pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-use-code-to-collapse-the-selected-l-layer-group-in-uxp/2591/2 "2021-02-25T12:45:03Z")

</div>

Collapsing a group with batchPlay can be done using:

```auto
await batchPlay(
[
   // collapse current selected group
      {
        "_obj": "collapseAllGroupsEvent",
        "_isCommand": true,
        "_options": {
          "dialogOptions": "dontDisplay"
        }
      }
],{});

```

> [@How To Expand A Group](http://forums.creativeclouddeveloper.com/t/how-to-expand-a-group/2565/3):
>
> Thanks @Pierre_G that solution worked out great. smiley

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/how-to-use-code-to-collapse-the-selected-l-layer-group-in-uxp/2591)._
