web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Difference between Job and Query

(0) ShareShare
ReportReport
Posted on by

Hello!

What is the difference between those two stuff? When should I use first or second instead of just method on my object?

*This post is locked for comments

  • Verified answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    You're comparing apples, oranges and locomotives.

    A job is an executable piece of code, almost as a class with a single main method.

    A query is used for reading data from database.

    Neither is a replacement for an instance method.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Job:

    piece of code, used/recommended for testing purpose. Testing refer to testing of anything. e.g. I want to test Numerals2Text, I may use a job for its testing.

    Technically jobs can work for  real world practical tasks also, but recommend only for testing purpose.

    in short you code for testing is usually I jobs.

    Query:


    Query has same concept as it has in any structure query language. it can be used for multiple purposes. you can use it behind any report, behind nay view, behind any form.  

  • Community Member Profile Picture
    on at

    "You're comparing apples, oranges and locomotives" -Good one :)

    1) So Jobs are more like sub -programs with ability to live independently or as a part of some workflow?

    2) Why should I use Queries if I can type X++ code (I mean this "t-SQL-style" code) in any place I want to?

  • Verified answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    1) Jobs are not used for any production code and no product should be shipped with them. Use them only in development if you want to try something.

    2) Queries integrated in X++ are still queries, nevertheless you seems to be asking why to use the query framework, such as queries in AOT and the Query class. The answer is reusability and extensibility. You can use such queries as form and report data sources, you can add ranges and data sources at runtime etc. Try the same with a select statement. :)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans