web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Change tab focus based on field change

(0) ShareShare
ReportReport
Posted on by 53
We have a business requirement on the case form to change the tab focus when a specific field changes... The catch is this field is on a contact form that we are using the built in control to display on the case form.  I have this code but I am unsure how we can get the code to read to the case form when the contact field is modified... Any help would be greatly appreciated! Thank you!
 
function FocusOnTab(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.ui.tabs.get(/general/).setFocus();
}
I have the same question (0)
  • RudyZhang Profile Picture
    Microsoft Employee on at
    Hi,
     
    Regarding your request to change the focus of a tab when a specific field is changed
     
    Our team has analyzed your requirement and here is our understanding of the problem: There are two forms, FormA and Form B. FormB is displayed on FormA using built-in controls, and when a field in FormB is changed, the tab focus of FormA changes.
     
    The following is the modified code of our team
    function onChangeField() {
        var formA = Xrm.Page.ui.formSelector.getCurrentItem(); // Get the currently selected FormA
        var tabB = formA.tabs.get("tabB_name"); // Replace with the actual Tab B name
    
        if (tabB) {
            tabB.setFocus();
        }
    }
    
    In addition, you need to use the code by following these steps
     
    Step1, open Dynamics 365 and navigate to the design screen of FormB.
    Step 2: Locate the specific field you want to modify and select it. In the field's property settings, look for the "Events" option.
    Step 3: In "Events", find the "OnChange" event and add the above JavaScript event handler.
    Step 4: Save and publish the changes to FormB.
     
    Note, please make sure you replace "tabB_name" in the code with the actual Tab B name, which is the name of the tab you want to switch to.
     
    I hope my answer is helpful to you! If you have any other questions, please feel free to contact me.
     
    Best Regards,
    Rudy Zhang
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans