web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Purchase invoice: change posting profile when generating invoice from PO

(1) ShareShare
ReportReport
Posted on by 8
Hello,
I would like to know if it feasible to change the posting profile of an invoice when generating the invoice from a purchase order.
It is a custom requirement to check for certain criterias when clicking the Generate invoice button and if the criterias are true, then the invoice needs to have a different posting profile from that of the purchase order (and ultimately the changed posting profile account in the account entries).
What is the best approach to do this?
Is there any such method available to extend in PurchFormLetter_Invoice to implement this logic?
I have the same question (0)
  • Jason0810M Profile Picture
    8 on at
    Purchase invoice: change posting profile when generating invoice from PO
    Any insight on this please?
  • André Arnaud de Calavon Profile Picture
    300,716 Super User 2025 Season 2 on at
    Purchase invoice: change posting profile when generating invoice from PO
    Hi Jason,
     
    Can you explain the exact business scenario functionally? What exact ledger accounts should be different? 
  • Jason0810M Profile Picture
    8 on at
    Purchase invoice: change posting profile when generating invoice from PO
    Hello Andre,
    The scenario is as follows:
    When posting an invoice of PO:
    If the sum of the vendor invoice line containing an AssetId is greater than the sum of non-asset vendor invoice line, then the invoice should have a different posting profile (as a different account should be charged).
    The problem with this is that the user can do partial invoicing. This means that if the aforementioned condition is false on a second posting, then the invoice should have the standard posting profile.
    I tried updating the VendInvoiceJour record only in the post of PurchInvoiceJournalCreate.createHeader() but the account is still the one associated to the standard posting profile in the GeneralJournalAccountEntries.
    I have tried a solution to add a new custom posting profile field on PurchTable.
    I have added the logic before the run of PurchFormLetter_Invoice to check if the condition is true based on the VendInvoiceInfoLine then update PurchTable.PostingProfile to the custom value and setting the PurchTable.XXXPostingProfile to the standard posting profile.
    If ever the condition is false for a second posting, then the PurchTable.PostingProfile will be updated to the PurchTable.XXXPostingProfile.
    It seems to be working in this way.
    However, I have a question regarding the implementation of the try catch.
    public void run()
        {
            int i = infologLine();
            try
            {
                tsbegin;
                this.customLogicToUpdatePurchTablePostingProfile(); 
            }
            catch
            {
                infolog.clear(i);
                if (appl.ttslevel()) == 0)
                {
                     ttsbegin;
                }
            }
            finally
            {
                next run();
                ttscommit;
            }
        }
    If ever there is a standard error in the run, then the update of PurchTable.PostingProfiles should be rollback. I have implemented the ttsbegin-ttscommit as shown.
    Is this the right approach to do it?
  • CU25041000-0 Profile Picture
    2 on at
    Purchase invoice: change posting profile when generating invoice from PO
    Hello i have the same Need.
     
    The business case is :
    when the Purchase Invoice is a Fixed Asset Acquisition and we want to create the fixed asset from the Purchase Invoice, we need to have a specific balance Account.
     

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 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans