Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Best way of triggering Purchase Order's version change

Posted on by Microsoft Employee

Good afternoon, 

Whole day's research on how PO confirmation versions works left me wondering what is the best approach of turning the order to unconfirmed mode, so later it can get confirmed and get a new version? 

I understand that if you change something that changes the purchase agreement, such as order line's quantity or order's payment terms, by default turns the order to unconfirmed state. I see the default code for it, but I'm struggling to follow the logic in case I wanted order to become unconfirmed after I change something, what is not considered as change of an agreement by default. Say, internal/external notes fields from DocuRef table, that are associated with the order and shown in PurchTable form? 

What logic should I follow in this case? 

Thank you! 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    Hi Sohaib,

    I am also stuck with a similar type of issue,I first confirmed the purchase order and later I relaise that i need to change the buyer group on header and the moment I change buyer group on purchase order header, system not taking me back to re-confirm the purchase order again and the confirm tab is grid off. I tried to do the same on standard AX, and it behaves in the same way. Is it a standard functionality of AX ?? I tried both the way, with or without using workflow.

    Look forward for your valuable response.

    Thank You

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    Hi Donatas, i need to prevent re-confirmation when trying to update itemtaxgroup field, in which class this code should be added?  Thanks

  • Suggested answer
    Asim Saeed Profile Picture
    Asim Saeed 575 on at
    RE: Best way of triggering Purchase Order's version change

    Hey Donatas,

    I have also came across some what the same issue, and what i did to cater the scenario is;

    I created a new class extends from VersioningPurchaseOrder and Added a added a method from parent,

    which sets the purchTable Modified field to TRUE to be picked for COnfiramation.

    public void markModified()
    {
    super();
    purchTable.IsModified = NoYes::Yes;
    }

    and finally I initialized the class and called 'markModified' method after super call.(You can do it in field modified as well) . In my case i did in clicked method.

    Let me know if it worked for you as well.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    Hi Donatas, Did you manage to find a better way of doing this?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    I think I may have found it!

    purchTable.type().updateDistribution();
    purchTable_ds.reread();
    purchTable_ds.refresh();
    
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    Putting it simple - after my custom field in PO form gets modified, I expect Purchase > Confirm button to become active, so after clicking on it a new version of Purchase order confirmation will be generated. 

    When I run your solution in modified() method of my custom field, the purchLine object is filled up with the information of the first line of the order. I haven't drilled down more, I'm afraid. 

    Thank you!

  • Jonathan  Halland Profile Picture
    Jonathan Halland 11,304 on at
    RE: Best way of triggering Purchase Order's version change

    Hi

    What happens when you execute my or other solutions? What are you expecting to occur?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Best way of triggering Purchase Order's version change

    Thank you, Jonathan. Yes, that's something similar to what I'm looking for, but unfortunately your solution didn't worked, even though it didn't returned any errors.  

    So I'm trying these little code snippets that I find in PurchLine and PurchTable objects, but nothing seems to work, and I fail to see a common code that is being shared between those elements, that are breaking the agreement.

    As AX documentation puts it "The purchase order is the most complex use of the versioning pattern in Microsoft Dynamics AX 2012.". 

    I'm hoping to find that "single line solution" somewhere :) 

  • Suggested answer
    Jonathan  Halland Profile Picture
    Jonathan Halland 11,304 on at
    RE: Best way of triggering Purchase Order's version change

    I'm not sure if this is what you are looking for, but you can try the following (Taken from purchLineType.update() )

    purchLine.updateWorkflowState(TradeWorkflowState::NotSubmitted);

    purchLine.purchTable(true).updateFromPurchLines(false);

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Best way of triggering Purchase Order's version change

    I think its totally a manual decision which is needed to be taken by business owners. They are the one who know that on changing of what it should trigger the re-confirmation of PO.

    for you being a technical person, you may create a setup, where there can be selection of fields from PurchTable and PurchLine. By selection of any field(s) on this setup, it would specify that on changing of data on theses fields, system should trigger/ask for re-confirmation of PO.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,113 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans