Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to add job code in class

(0) ShareShare
ReportReport
Posted on by 2,256

Hi Experts,

Our requirement to auto cancel Sales Order if Sales Order created 3 day longer. I tested with Job as given below but I would like to know how to add in class.

static void AutoCancelSO(Args _args)
{
SalesTable salesTable;
   
    update_recordSet salesTable setting SalesStatus=SalesStatus::Canceled where salesTable.createdDateTime >= DateTimeUtil::addDays(DateTimeUtil::utcNow(), -3);
    
   
    
}


*This post is locked for comments

  • István Orosz Profile Picture
    2,137 on at
    RE: How to add job code in class

    Hi Faiz,

    Documentation was linked before me, just a practical advice:

    - if all you want to implement is this short logic, a simple RunBaseBatch would be enough, do not need to bother with the SysOperation framework.

    Kind regards,

    István Orosz

  • André Arnaud de Calavon Profile Picture
    294,715 Super User 2025 Season 1 on at
    RE: How to add job code in class

    Hi Faiz,

    The guide provided by Blue Wang is a good start. A similar document can be found here: docs.microsoft.com/.../walkthrough-extending-runbasebatch-class-to-create-and-run-a-batch

    If you need a dialog to make the number of days configurable, you can also read the next page: docs.microsoft.com/.../using-classes-to-create-a-dialog

    In that case, you need to implement pack and unpack to store the dialog values: docs.microsoft.com/.../pack-unpack-design-pattern

  • Blue Wang Profile Picture
    on at
    RE: How to add job code in class

    Hi Faiz,

    Batch jobs can be added and automatically executed.

    There's a little guide: https://www.linkedin.com/pulse/microsoft-dynamics-ax-r3-batch-job-creation-through-code-gulfam

     I hope it will help you.

  • faiz7049 Profile Picture
    2,256 on at
    RE: How to add job code in class

    Hi  André,

    I want to execute code automatically everyday. How to do it.

  • André Arnaud de Calavon Profile Picture
    294,715 Super User 2025 Season 1 on at
    RE: How to add job code in class

    Hi Faiz7049,

    You can create a class and move the coding in it. Do you need to be able to run the class as batch job? How to do it exactly depends on this question. You can have a look at many other classes in the system to learn how.

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 Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans