Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Is it possible to override selectionChange method on extended form

(0) ShareShare
ReportReport
Posted on by 1,479
i have extended form which is having a combox  on the selection of specific value on combo box i want to make the field on form data source non editable so i have written the selection change method on that combo box control but it is not working can any one guide me on this . 
my code is below 
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Is it possible to override selectionChange method on extended form
    Just continue with updateControl method. It will work when you open the form.
     
    Thanks,
    Girish S.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    Is it possible to override selectionChange method on extended form
    hi girish ,
    thanks for reply,
    yes update control method is on init method so as of now i will continue with update control method. irs working fine .thanks martin .
     
    thanks ,
     regards ,
     dinesh
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    Is it possible to override selectionChange method on extended form
    I suggested updateControls() method because it's designed for this purpose and it's called both when opening the form and changing the value of ViewMode. So you need neither an event handler nor any extra code in init().
     
    active() is not relevant to your requirement, because your logic depends only on ViewMode and not the currently active record.
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Is it possible to override selectionChange method on extended form
    I checked in the ProjWorkBreakDownStructureV2 form - updateControl method is called in the init method of the form.
    So it will work if you open the form also. Try to debug the code.
     
    Thanks,
    Girish S.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    Is it possible to override selectionChange method on extended form
    hi girish s 
     
    can you please guide me how can i replace my code instead of using update controls and write the code on init or active method .
    what should i write in init or active method should i need to remove update controls code from here . on this code the field is getting enable /disable  on condition do i need it to change it to init method if yes then can you provide me any example so i can get it done .
    [ExtensionOf(formStr(ProjWorkBreakdownStructureV2))]
    final class DT_PSAActivityEstimatesDK_Extension
    {
        /// <summary>
        ///     Updates the control visibility and editability.
        /// </summary>
        protected void updateControls()
        {
            next updateControls();
    
            PSAActivityEstimates_ds.object(fieldNum(PSAActivityEstimates, ProjectValue))
                .allowEdit(ViewMode.selection() == ProjWorkBreakdownStructureViewMode::CostEstimates);
        }
    
    }
     
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Is it possible to override selectionChange method on extended form
    So, you are saying that changes are reflecting when you open the form right?
    In that case you need to either write form level init method or DataSource active method.
     
    Thanks,
    Girish S.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    Is it possible to override selectionChange method on extended form
    hi martin , 
    so you want to say i need to do this with the method designed for this purpose, i can get the logic to apply  when the form opens , so do you eant me to use event handler for this or any other chain of command method .
  • Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    Is it possible to override selectionChange method on extended form
    Doing it at a control change only isn't correct, in my opinion. Even if you want to ignore the method designed for this purpose, are you sure that you don't want the logic to apply when the form opens?
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    Is it possible to override selectionChange method on extended form
    hi martin ,
    the update controls code is working , i will definately follow the steps you have mention , try to work on my debugging . 
    thanks for guiding me on this .
     
    hi Girish ,
    i will definately try the event handler to study the effect how it works thanks for your suggestion ,
    and code 
     
    thank you guys  , 
     regards ,
    dinesh 
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Is it possible to override selectionChange method on extended form
    Exactly, you need to use the OnSelectionChanged event handler of the combo box control.
     
    Thanks,
    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans