Skip to main content

Notifications

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 ?? 
  • Suggested answer
    Martin Dráb Profile Picture
    232,968 Most Valuable Professional on at
    Dynamic Query in D365 Finance & Operations
    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,206 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,968 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans