Skip to main content

Notifications

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

Reopen a Purchase Order to update via API v2

(1) ShareShare
ReportReport
Posted on by 16
Hi, I have no experience with Dynamics 365 Business Central. I'm building a Purchase Order integration from an external application to D365.
It appears to me to update an existing Purchase Order, it needs to be reopened. But, I haven't found a way to reopen a PO using the standard API. 
 
 
If I tried using the Update PO request to set the status field to "Open" resulted in an error "Control 'status' is read-only".
 
I do not have access and the D365 skills to develop a custom API. Is there a way to reopen a PO using the standard API v2? If not, is there a workaround?
 
  • Suggested answer
    Yi Yong Profile Picture
    Yi Yong 1,450 Super User 2024 Season 2 on at
    Reopen a Purchase Order to update via API v2
    Hello VTRAN,
     
    Codeunit Release Purchase Document is a standard codeunit, you need to call this codeunit and run the respective function to set the status of the purchase document.
     
        trigger OnAfterGetRecord()
        var
            ReleasePurchaseDocument: Codeunit "Release Purchase Document";
        begin
            ReleasePurchaseDocument.PerformManualRelease(Rec);
        end;
  • VTRAN Profile Picture
    VTRAN 16 on at
    Reopen a Purchase Order to update via API v2
    It sounds like this simple action with a standard API is impossible, and custom code/API is the way to go. Thank you all for the answers.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,036 Super User 2024 Season 2 on at
    Reopen a Purchase Order to update via API v2
    Hi, It is somewhat similar to my test below, I hope it can give you some hints.
    Dynamics 365 Business Central: Release a Sales Order with Power Automate
     
    PS: Dynamics 365 Business Central: How to use Standard/Custom API Bound Actions
     
    Thanks.
    ZHU
  • VTRAN Profile Picture
    VTRAN 16 on at
    Reopen a Purchase Order to update via API v2
    @Yi Yong: I don't understand what it means "Codeunit Release Purchase Document"? Did you mean developing some custom code to call this function? or can it be executed via the API?
  • Suggested answer
    Yi Yong Profile Picture
    Yi Yong 1,450 Super User 2024 Season 2 on at
    Reopen a Purchase Order to update via API v2
    Hello,
     
    You should not edit the ‘Status’ field directly, as it may cause downstream issues such as workflow, prepayment etc.
     
    You can use Codeunit "Release Purchase Document" to change the field status.
    ReleasePurchaseDocument.PerformManualReopen(Rec);
    ReleasePurchaseDocument.PerformManualRelease(Rec);
  • Suggested answer
    Umut Dogan Koc Profile Picture
    Umut Dogan Koc 87 on at
    Reopen a Purchase Order to update via API v2
    Hello,
     
    Editable property of Status field is false in "APIV2 - Purchase Orders" , that's why it can't be modified through patch request. A custom API can be developed. 
     

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans