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 :
Finance | Project Operations, Human Resources, ...
Answered

Where is the best CoC to do after PO status changing to Confirmed?

(1) ShareShare
ReportReport
Posted on by 1,036
Hi dear community !
 
There is a customization that will run an Async batch job that will change the PO status to confirmed.
 
I want to add my logic after the PO status have been changed to "Confirmed".
I tried putting my logic as the next line after the line that will run the batch job I had an issue.
Because it's an Async batch job, some times my logic will run before the batch job have finished, so my logic will run before the PO status have been changed to "Confirmed".
 
So i'm wondering where to put my logic to run after making sure the PO status have been changed to confirmed.
 
I thought of using CoC to PurchTable.update() method, but I would prefer to not use the update method.
 
The batch job class and method being used to do the PO confirmation is "PurchFormLetter.update()".
 
Where should I put my logic to run after this batch job changes the status of the PO to confirmed?
 
Any advice is appreciated !
Thanks in advance !
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at
    You can use the class actually posting the confirmation: SalesConfirmJournalPost. For example, you could utilize endPost() method.
     
    You can see the overall process in post() method of the parent class, FormletterJournalPost.
  • Verified answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    You can check 
    Class name: FormLetterService
    Method name: postPurchaseOrderConfirmation.
     
    This the common class which is used for purchase order confirmation. Post next based on journal created, custom logic can be added
  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at
    The verified answer is actual far from ideal.
     
    For example, imagine that you're posting 1000 invoices. If you use an extension of FormLetterService.postPurchaseOrderConfirmation(), your code will run at some point after all of them have been posted and you'll need to iterate all the confirmations journals again and check which POs were included there. It's certainly possible, but it's a different thing than what the question was about. It asked about a status change of a particular purchase order.
  • Momochi Profile Picture
    1,036 on at
     
    Appreciate your valuable insights.
     
    Kindly correct me if I'm wrong but isn't SalesConfirmJournalPost used for Sales Orders only?

    I tried seeing references of the parent class "FormletterJournalPost" But I couldn't see an extended class related to Purchase Orders.
  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at
    The framework is used for for various kinds of postings - sales order confirmation, purchase order invoices and so on. There are sub-classes for the individual scenarios, such as PurchConfirmationJournalPost for posting of purchase confirmations.
     
    I apologize that I originally mentioned SalesConfirmJournalPost instead of PurchConfirmationJournalPost; you could have pointed out that.
     
    Let me also teach you how you could have found the right class by yourself. You know that the process can be started from FormLetterService.postPurchaseOrderConfirmation(). Open it; you'll see that it just calls this.run(), but also that there is an object with parameters: an instance of PurchFormLetterPurchOrderContract class. Open it and notice getDocumentStatus() method, which returns DocumentStatus::PurchaseOrder. Use Find all references on this enum value and you'll get references to several related classes, such as FormletterJournalCreate, FormletterJournalPost and FormletterJournalPrint. You're interested in posting, therefore you want FormletterJournalPost and references also mentioned newPostPurchNoThrow() method. Open it and you'll see that the class used for DocumentStatus::PurchaseOrder is PurchConfirmationJournalPost.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans