Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to collapse(not close) a side pane via JS?

(0) ShareShare
ReportReport
Posted on by 1,469
I can get the side pane object using the JS code below, but I would like to know how to collapse a side pane by OOTB method. I know there are /close/ and /hidden/ properties I can use, but this property would get the entire side pane disappear.
 
let copilotSidePane = Xrm.App.sidePanes.getAllPanes().getAll()[0]
// The close method hides the whole side pane, but I only want to collapse it.
copilotSidePane.close();
  • Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    How to collapse(not close) a side pane via JS?
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     
  • Verified answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    How to collapse(not close) a side pane via JS?
    Hi,
     
    You can get the HTML element of the side pane button. Then implement the click event by automatically clicking this button with the following code.
    Because clicking on the side pane button collapses the side pane.
    function onload() {
        //get the Copliot button HTML element
        var copliot =  window.top.document.querySelector("button[aria-label='Copilot']");
     
        //Programmatically trigger the click event.
        const evt = new MouseEvent("click", { bubbles: true, cancelable: true });
        copliot.dispatchEvent(evt)
    }

    For more information on this method please refer to the following link.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,703 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans