Skip to main content

Notifications

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

DataSource RegisterOverRide method.

(0) ShareShare
ReportReport
Posted on by 24

Hi guys,

         My Requirement is need to exclude my Form's datasource executeQuery() method, Is posible to use RegisterOverRide in Form's datasource methods. Any idea?

  • Arjun Venkatesan Profile Picture
    Arjun Venkatesan 24 on at
    RE: DataSource RegisterOverRide method.

    Really Thank you So much brother.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: DataSource RegisterOverRide method.

    No, you can do via registerOverride method also. But that's not needed you can simply add your code in the event handler or COC of executeQuery method.

    If you still want to do it with registerOverride method, then the syntax will be something like below.

    FormDataSourceName_ds.registerOverrideMethod(methodstr(methodToOverride, methodToCall));
    FormDataSourceName_ds.registerOverrideMethod(methodstr(FormDataSource, executeQuery), formMethodstr(
            FormName, MethodName)

    Thanks,

    Girish S.

  • Arjun Venkatesan Profile Picture
    Arjun Venkatesan 24 on at
    RE: DataSource RegisterOverRide method.

    Thanks for the reply Mr.Girish,

               So Datasource methods Can't do registerOverRide()?

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: DataSource RegisterOverRide method.

    If it's a custom form - Is, it possible to do the changes directly in that form?

    If not, then as Martin mentioned you can clear out the DataSource joins from the eventhandler or COC of the executeQuery method.

    You can make use of clearLink method on the QueryBuildDataSource class to clear out the added DataSource and add your own DataSource with joins.

    Thanks,

    Girish S.

  • Arjun Venkatesan Profile Picture
    Arjun Venkatesan 24 on at
    RE: DataSource RegisterOverRide method.

    Yes,

     Hi Mr.Girish yes Referring form is also a custom Form but different model. I mean I'm trying to reach this with my two custom models.

  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    RE: DataSource RegisterOverRide method.

    Your dwsign sounds wrong to me. If you use a custom method instead of executeQuery(), the kernel implementation of executeQuery() won't be called and therefore the query won't execute and data won't be loaded.

    Please tell us more about the actual problem, so we can help you with designing a feasible solution.

    For example, if the override of executeQuery() in the standard form adds query data sources that you don't want, you can disable them by your code.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: DataSource RegisterOverRide method.

    Form you are referring to is a custom form or standard form?

    Thanks,

    Girish S.

  • Arjun Venkatesan Profile Picture
    Arjun Venkatesan 24 on at
    RE: DataSource RegisterOverRide method.

    Hi Mr.Martin and Mr.Girish,

         Thanks for your reply, I'm new in D365fo, Actually my requirement is I need to change the logic of existing form's executeQuery() method. That Form have executeQuery() method with different tables joining. I need to exclude them and have to add my own logic on that executeQuery() method which means need to avoid existing executeQuery code it should run my logic only.

    If its is possible with registerOverrideMethod() please guide me how to use?

  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    RE: DataSource RegisterOverRide method.

    Can you tell us more about your requirement, please?

    If you don't want the query to execute automatically, can't you simply turn it off (by setting it AutoSearch property of the data source to No)?

    Using registerOverrideMethod() is possible, why would you do it in your form? If you need to change executeQuery() method, simply, change its code. For example, if you want executeQuery() to be called automatically but you want to skip the method body in some cases, simply put an "if" condition to executeQuery().

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: DataSource RegisterOverRide method.

    Hi Arjun,

    Can you elaborate on your question? What is the functionality you are doing and what is a need to exclude call to executeQuery method.

    Based on that we will give you a suggestion.

    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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans