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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Dynamic Query in D365 Finance & Operations

(0) ShareShare
ReportReport
Posted on by
Hello,

I am facing an issue where I am trying to use method clearLinks() on the form Datasource Query, but it is not working as expected and instead it is adding the same datasource over and over again to the parent datasource whenever executeQuery() method is called. Any suggestions as to how this issue can be resolved ?? 
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at
    No, clearLinks() isn't adding the same data source again. It seems that you have your code calling addDataSource() every time.
     
    Consider if you must add the data source in code - maybe you should add it in the form designer and merely disable it in code when you don't need it.
     
    If you must add it in code, and it must be in executeQuery(), not init(), you can store the QueryBuildDataSource object in a form-level variable. When calling executeQuery() again, you'll use the object from the variable, if set. Alternatively, you could check if the query already contains the data source (e.g. by using SysQuery::findOrCreateDataSource()).

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans