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

Hello,
How to use code to collapse the selected l layer group in uxp?
I can’t get this function from the API of uxp, but it’s strange that I can get the function of collapsing all groups.

Collapsing a group with batchPlay can be done using:

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

This is a really great command! It collapses all group layers in the document, which definitely has utility. If a person just needs to collapse or show a single group, that command is located here.
(I know you know already Pierre, I am including this for easy navigation)