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 :
Small and medium business | Business Central, N...
Suggested Answer

Purchase Invoice created in a Page Api call sets wrong values in field

(0) ShareShare
ReportReport
Posted on by 77

I have a Purchase Invoice Page API that runs in my demo tenant sandbox environment. I have set it to use Document Date and Due Date fields. When I create a new purchase invoice using those fileds it fills them with wrong values.

The Due Data field gets the Document Date field value, and the Document Date sets the current date as the value. 

If I try to update those two fields to correct values, then It just uses the Document Date value to for both fields.

When I repeat the patch action for the second time with the same values, only then are the Due Date and Document Date fileds correct.

All the actions are done in Postman.

How can I force the request to fill the fields with correct values?

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi chigivigi ,

    When you created a new Purchase invoice, system always takes Posting Date, document date and due date as system defaults workdate, I am not sure how your api is working when you are creating a new Purchase invoice and how its filling all this date

    Can you please more describe it?

    Thanks.

  • chigivigi Profile Picture
    77 on at

    I am passing the Document Date and Due Date in the body as string values (YYYY-MM-dd). I create a post action in postman and set the body as a raw JSON.

    pastedimage1652082488811v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi chigivigi ,

    Are you using the Patch command?

    Where you are passing the Purchase Invoice No.?

    Thanks.

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Also please check below image, you are taking both places a Document Date, it that correct?

    pastedimage1652082794208v1.png

  • chigivigi Profile Picture
    77 on at

    I apologize, I put the wrong value inside the body. I am using the pot command.

    This is the command:

    pastedimage1652083375837v1.png

    pastedimage1652082934602v2.png

    This is the Patch Command:

    pastedimage1652083393799v2.png

    pastedimage1652082991018v4.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    When you first entering the Document date, system is calculating the Due date based on the Payment terms attached with vendor card and putting the same value in Due date, its means its validating the Document Date field's trigger code.

    Thanks.

  • chigivigi Profile Picture
    77 on at

    Is that also the reason that the Document Date fields uses the current Date as the value?

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Yes, its validating the Document Date field's code.

  • chigivigi Profile Picture
    77 on at

    Thank you for your help.

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans