Skip to main content

Notifications

Announcements

No record found.

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

Access controls at an extension method forms

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,274 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;

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans