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...
Suggested Answer

Set field focus on option set

(0) ShareShare
ReportReport
Posted on by 1,023

Hi,

I want to set the field focus on the option set value on load of the form in Unified client Interface. Please advise on how I can do this?

Please advise the JS to do this

Thanks,

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi James,

    You can set focus on a control with the SetFocus Client API.

    formContext.getControl(arg).setFocus();

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    You could use "formContext.getControl(arg).setFocus()" to archive this.

    1.Add the JS function into form onload event.

    pastedimage1584580537059v1.png

    Remember to select "Pass execution context as first parameter".

    2.Save and publish.

    No focus.

    pastedimage1584581909578v3.png

    Focus.

    pastedimage1584581811025v2.png

    function getFocus(executionContext){
        var formContext = executionContext.getFormContext();
        formContext.getControl("new_option").setFocus();
    }

    Regards,

    Leo

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 60 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 51

#3
Satyam Prakash Profile Picture

Satyam Prakash 42

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans