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)

How Can I prevent the posted or open sales / purchase orders from getting impacted by the recent changes

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have customized the Relased product details form by adding a group in it.

The new group contains three custom fields which also added in inventtable.

Whenever I change the details in the new group added of an item, then the changes should get reflected only to the Sales / Purchase orders which will be created after the changes done to the new group of the item.  I mean the existing posted Sales  / Purchase orders, if they contains  the item I have changed should not be impacted as they are posted. Similarly the open Purchase / Sales orders should not get impacted. 

The Only Sales / Purchase orders created after the changes done should reflect the changes.

How can I achieve this, where can I create logic for this ? Please guide me

Regards,

Nishath

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi ax_dizzyness,

    AX obviously does not know when you made this change, so you have to put in your code criteria to update order that were created after specific date.  

  • Community Member Profile Picture
    on at

    Hi Ivegen,

    Thanks for the reply. Can you please gv some sample code for this please

    Regards,

    Nishath

  • Mea_ Profile Picture
    60,286 on at

    I dont know what code you already have, so sharing it could be a good starting point.

  • Community Member Profile Picture
    on at

    Sure I ll share you in next few mins. Please do revert me what should I make changes in it please

  • Community Member Profile Picture
    on at
    display public NoYes AZ_validateExemption()
    {
        // Azelis -->
        InventTable                 inventHsnSacExempt;
        AZ_HsnSacTransValidation_IN validateHsnSacTrans;
        ItemId                      salesLineItemId;
        SalesLine                   salesLineRecid;
        NoYes  retHsnSacExempt;
        #isoCountryRegionCodes
    
        if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoIN]))
        {
            if (this.SalesStatus == SalesStatus::Invoiced)
            {
                salesLineItemId =   SalesLine::find(this.SalesId).ItemId;
                salesLineRecid  =   SalesLine::find(this.SalesId);
                while select HsnSacExempt from validateHsnSacTrans
                    where validateHsnSacTrans.HSNItemId == salesLineItemId
                if (    validateHsnSacTrans.createdDateTime     <=  this.createdDateTime
                    ||  validateHsnSacTrans.createdDateTime <=  salesLineRecid.createdDateTime )
                {
                    retHsnSacExempt = validateHsnSacTrans.HsnSacExempt;
                }
            }
            else
            {
                salesLineItemId =   SalesLine::find(this.SalesId).ItemId;
                salesLineRecid  =   SalesLine::find(this.SalesId);
                while select HsnSacExempt from validateHsnSacTrans
                    where validateHsnSacTrans.HSNItemId == salesLineItemId
                if (    validateHsnSacTrans.createdDateTime     > this.createdDateTime
                    ||  validateHsnSacTrans.createdDateTime     > salesLineRecid.createdDateTime)
                {
                    retHsnSacExempt = validateHsnSacTrans.HsnSacExempt;
                }
                else if (   validateHsnSacTrans.createdDateTime == this.createdDateTime
                         || validateHsnSacTrans.createdDateTime == salesLineRecid.createdDateTime)
                {
                    retHsnSacExempt = validateHsnSacTrans.HsnSacExempt;
                }
                else
                {
                    select firstOnly Exempt_IN from inventHsnSacExempt
                    where inventHsnSacExempt.ItemId == salesLineItemId;
                    if (inventHsnSacExempt)
                    {
                        retHsnSacExempt = inventHsnSacExempt.Exempt_IN;
                    }
                }
            }
        }
        return  retHsnSacExempt;
        // Azelis <--
    }


    Hi Ivegen,

    Please find my code above.

    This code is not working as expected.  Whenever I made changes to the Item for the new group , then with our validating if Sales / Purchase orders posted or in open status getting changed 

    Please let me know what am I doing wrong in the code ?

    Regards,

    Nishath

  • Mea_ Profile Picture
    60,286 on at

    Sorry I cannot help you, this code is completely wrong. You are selecting random sales line from sales order, then you use fields that have not been selected. It's full of copy-paste. You definitely need someone who can help you to develop your skills and guide you before trying to do real tasks. And this method should be rewritten from the scratch and definitely should not be a display method.

  • Community Member Profile Picture
    on at

    Hi Ivegen , I have created this display method under salestable.  And the reason why am I using display method is because on the new group I have created under Released Product details form should get updated values from the display method.

    And the next condition is only the orders creating after changes been made should get impacted ?

    Please tell few things like what would be the start I should go for ?

    Regards,

    Nishath

  • Community Member Profile Picture
    on at

    Also I have debugged the code and it is giving me the correct active recid of the salestable

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans