A collegue asked me if it is possible to create a purchase invoice every month very simple. The customer who needs this is on BC21 (SaaS) and has at the moment no own AL code, so we want to leave it like that.
My Answer yes it is possible, without writing one single line of code.
The answer is Power Automate
The solution is so simple that writing about tooks me longer than implemnting it. I show you how to do it.
First step create a recurring Power Automate flow. I selected to execute it once a month
Second step: create a purchase invoice via API v2.0 (https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/resources/dynamics_purchaseinvoice)
Third step: Add a line to new created purchase invoice using also API v2 (https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/resources/dynamics_purchaseinvoiceline)
That’s it, it took me about 10 Minutes for the proof of concept. When I would start implenting it in AL. It would be much more complicated and time consuming