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 :
Microsoft Dynamics AX (Archived)

How to cancel Line Status "open order" in SalesLine

(0) ShareShare
ReportReport
Posted on by 2,382

Hi Expert,

I am try to cancel Sales Order Status "Open Order" as well as SalesLine Line Status "open order".

Let me explain in brief:

Requirement is if any SalesOrder status "Open Order" except 3 days from createdDateTime. it should cancel as well as SalesLine item if line item status "open order"

By below jobs I am able to cancel SalesOrder Status to cancel but how to cancel SalesLine item as well.

static void AutoCancelSalesOrder&SalesLine(Args _args)
{
SalesTable salesTable;

   update_recordSet salesTable setting SalesStatus=SalesStatus::Canceled where salesTable.createdDateTime < DateTimeUtil::addDays(DateTimeUtil::utcNow(), -3) && salesTable.SalesStatus==SalesStatus::Backorder;

}


Please help me on above job code

*This post is locked for comments

I have the same question (0)
  • faiz7049 Profile Picture
    2,382 on at

    Please look the job code..

  • André Arnaud de Calavon Profile Picture
    301,079 Super User 2025 Season 2 on at

    Hi Faiz,

    It is not possible to just change the status field as there are methods which will 'calculate' this value. It depends on the remaining quantity to be delivered on the sales order lines. Functional wise, you can update the deliver remainder per sales order line. When this is all zero, the status will be changed accordingly. See how this feature works and try to automate this part using coding.

  • faiz7049 Profile Picture
    2,382 on at

    Thanks for reply André Arnaud de Calavon,

    Actually we have customized invoice button which are not requirement any picking journal posting just add item and invoiced it.

    But we found a lot Sales order opened since using AX so we cancelled not required Sales orders which were open status this now.

    Many time we requested to Salesman do not leave Sales order open to long but they are not listening us.

    So we need to control it and show to Management that these are Sales order and cancelled by AX because It was created before 3 days and Salesman are not caring  it.

    My jobs working but item/items which are in Sales order still showing on order because Sales Order cancelled in SalesTable not in SalesLine item line.

    Please if any one can modify my jobs code as to meet my requirement.

  • André Arnaud de Calavon Profile Picture
    301,079 Super User 2025 Season 2 on at

    Hi Faiz,

    Like mentioned above, the job should do a cancellation of the quantities using the delivery remainder functionality. Then the 'on order' issue will be solved and the status will be set by the system itself. If I did have such job myself already, I would have shared it. But I can't spent time to do the actual work for you.

  • faiz7049 Profile Picture
    2,382 on at

    Thank you

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans