Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Access controls at an ...
Finance forum

Access controls at an extension method forms

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

The question is, how can I access to the controls of the form in a event handler method? my case is how the next image: 

4760.extensionMethod.png

You can see that it clearly marks me an error when trying to access the control, and I'm not sure that I get the reference to the form using "args.getThis ()" thanks, and if there is another way to do it would be very helpful

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Access controls at an extension method forms

    Hi Felipe Lopez,

    I would not follow Sukrut Parab advice directly, because before calling any methods on a control it is good to check that it is not null. So first retrieve a control, using one of the methods proposed by Sukrut Parab, check that t is not null and then call visible or any other method you need to avoid runtime errors.

  • Verified answer
    Basheer17 Profile Picture
    Basheer17 2,720 on at
    RE: Access controls at an extension method forms

    Hi Felipe Lopez,

    args.getThis will return FormRun object. Using the FormRun object you can access controls as shown below

    var reqControl = formRun.design().controlName(formControlStr(Form, FormControl)) as FormGroupControl/or (Any req control);

    Ex: 

    var docuRef_Notes = formRun.design().controlName(formControlStr(DocuView, docuRef_Notes)) as FormStringControl;

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans