Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)

Posted on by 54
Didn't come across this is my testing, so I am baffled.

If I try and create a new Purchase Invoice for some vendors I get the following error. If I create one for a different vendor, I can then change the bill-to vendor to the correct one and all is fine (but not a nice workaround). 
In Sandbox I have removed all extensions and it still does it. 
 
I have checked Number Series and all seems okay - nowhere near the 'limit'. The vendor account looks like without any missing fields, and doesn't look different to any of the vendors I've tried that do work. I cannot fathom a reason why some do and some don't work.
Any thoughts were to look and what to change?

 

If requesting support, please provide the following details to help troubleshooting:

The Purchase Header does not exist. Identification fields and values: Document Type='Invoice',No.='107940'

Internal session ID:
bd6fc9fa-f014-4bad-ac49-e550056f93e2

Application Insights session ID:
410629d3-31e9-4831-b1e6-b71edad3d372

Client activity id:
bfaf79c1-abae-494b-a9ae-2aad75d5e08c

Time stamp on error:
2023-11-09T09:52:17.2247262Z

User telemetry id:
edb45559-969b-4e43-bd82-8fe6dd4e8c5b

AL call stack:
/Purchase Line/(Table 39).GetPurchHeader line 11 - Base Application by Microsoft
/Purchase Line/(Table 39).GetPurchHeader line 2 - Base Application by Microsoft
/Purchase Line/(Table 39).GetDateForCalculations line 3 - Base Application by Microsoft
/Purchase Line - Price/(CodeUnit 7021).GetDocumentDate line 2 - Base Application by Microsoft
/Purchase Line - Price/(CodeUnit 7021).FillBuffer line 36 - Base Application by Microsoft
/Purchase Line - Price/(CodeUnit 7021).CopyToBuffer line 10 - Base Application by Microsoft
/Price Calculation - V16/(CodeUnit 7002).ApplyPrice line 10 - Base Application by Microsoft
/Purchase Line/(Table 39).UpdateDirectUnitCostByField line 34 - Base Application by Microsoft
/Purchase Line/(Table 39)./No. - OnValidate/(Trigger) line 125 - Base Application by Microsoft
/Standard Vendor Purchase Code/(Table 175).ApplyStdCodesToPurchaseLines line 41 - Base Application by Microsoft
/Standard Codes Mgt./(CodeUnit 170).CheckCreatePurchRecurringLines line 13 - Base Application by Microsoft
/Purchase Header/(Table 38).OnInsert(Trigger) line 18 - Base Application by Microsoft
/Purchase Invoice/(Page 51)./Buy-from Vendor No. - OnValidate/(Trigger) line 4 - Base Application by Microsoft
 

Many thanks, Tristan

  • BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)
    Has anyone received any resolutions for this? One of my customers is experiencing this issue as well. I have a support case in with Microsoft, but I just wanted to check here as well since they are rather slow these days. 
     
    The only workaround I can suggest is changing the Purchase Recurring Lines to be "Always Ask", but it's still not a real solution to the issue. 
     
    Thanks
    Lindsay
  • tristancliffe Profile Picture
    tristancliffe 54 on at
    BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)
    Alas, I cannot submit a support request myself, but I'll try and persuade my MS Partner to do it for me...
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)
    What a strange problem😑. If you can't find the specific problem, I suggest you submit an SR to the Microsoft support team.
     
    Thanks.
    ZHU
  • tristancliffe Profile Picture
    tristancliffe 54 on at
    BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)
    I have narrowed it down.
     
    If I have Recurring Purchase Lines set on Automatic for this vendor/document type, I get the error.
    Other vendors without recurring purchase lines are fine.
    If I change the type to Manual or Always Ask then it's fine but then it's a manual process that I would like to avoid.
     
    This was 100% fine in 2023 Wave 1 and before, without and without my customisations. Removing custom apps in Sandbox doesn't make a difference with 2023 Wave 2.
     
    Debugging got me to this section of Table 38 Purchase Header:
     
    trigger OnInsert()
        var
            IsHandled: Boolean;
        begin
            OnBeforeOnInsert(Rec, IsHandled);
            if IsHandled then
                exit;
    
            InitInsert();
    
            if GetFilter("Buy-from Vendor No.") <> '' then
                if GetRangeMin("Buy-from Vendor No.") = GetRangeMax("Buy-from Vendor No.") then
                    Validate("Buy-from Vendor No.", GetRangeMin("Buy-from Vendor No."));
    
            if "Purchaser Code" = '' then
                SetDefaultPurchaser();
    
            if "Buy-from Vendor No." <> '' then
                StandardCodesMgtGlobal.CheckCreatePurchRecurringLines(Rec);   <---- THIS LINE IS HIGHLIGHTED IN THE DEBUGGER
        end;
     
    Not that that gets much much closer to fixing it, but I'm 99.9% sure it's an issue with automatic recurring purchase lines. I shall continue to dig, and will update this is I solve it in case other people have the same issue.

    Edit: I have compared the code between V22.5 and V23.0 in the codeunit Standard Codes Mgt..dal and they are the same other than the addition of namespaces and using at the top. Every line thereafter is identical. So I'm either going to have to go deeper, or I'm already on the the wrong track and will just get lost!
  • Suggested answer
    Shauna Langley Profile Picture
    Shauna Langley 691 Super User 2024 Season 2 on at
    BC SaaS 2023 Wave2 - New Purchase Invoice not working (some vendors)
    Hi,
     
    I can't see from your screen shot but are you entering the vendor name and then getting this error?  Sometimes when I have come across that I click on the Show More of the General tab and then enter the details in the vendor no field.
     
     
    Hope that helps,
    Shauna

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans