Customer Engagement & Dynamics CRM Forum

Javascript: Which tab has the focus?

  • 1.  Javascript: Which tab has the focus?

    Posted 18 days ago
    In Dynamics 365, I have a ribbon button (created with Ribbon Workbench) that saves the entity and refreshes the form via Javascript using:

    The problem, as you might guess, is that this moves focus back to the top of the form, when the user might have been working much further down in the form.  Additionally, I've discovered I can then "move" the focus to a specific tab on the form using this:

    var tab = formContext.ui.tabs.get("TabName"); if (tab) { tab.setFocus(); }

    The problem with that is that I don't know which tab had focus before the form was refreshed.  Is there any way to detect and store the name of the active tab at the time the ribbon button is clicked?  (Complicated by the fact that focus has just shifted to the ribbon button anyway.)  If not, how can I get the screen to refresh and still scroll down to the tab the user was using?

    Thanks in advance.

    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready

If you've found this thread useful, dive deeper into User Group community content by role