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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

PO Report Attachment Automatic; Putting SO No. in Planning Worksheet

(1) ShareShare
ReportReport
Posted on by 2

Hi Everyone,

I am working on the AL coding to fulfil my company's demand but I'm facing a couple of problem here.


1.
I have created an Automate Flow when users press the /Send Approval Request/ button in the Purchase Order page.

So we can find the button /Attach as PDF/ in Print/Send, but I want it automatic.
What I'm trying to do is to automatically generate a PO report to the document attachment when a user press the /Send Approval Request/ button before my flow gets start.

Therefore, my flow can merge the PO PDF file with my Power BI reports.
Simply saying, I want the /Attach as PDF/ automatically done when I press /Send Approval Request/.

I have changed some part of the code from this website (https://yzhums.com/20657/) to suit my situation as below:

 

pageextension 50108 PurchaseOrderExt extends /Purchase Order/
{
    actions
    {
        modify(SendApprovalRequest)
        {
            trigger OnAfterAction()
            var
                ReportSelections: Record /Report Selections/;
                Usage: Enum /Report Selection Usage/;
                PurchaseHeader: Record /Purchase Header/;
            begin
                PurchaseHeader := Rec;
                PurchaseHeader.SetRecFilter();
                ReportSelections.SaveAsDocumentAttachment(
                            Usage::/P.Order/.AsInteger(), PurchaseHeader, PurchaseHeader./No./, PurchaseHeader./buy-from Vendor No./, false);
            end;
        }
    }



However, when I press the /Send Approval Request/ button,
it shows this error and I couldn't solve this:

The changes to the Purchase Header record cannot be saved because some information on the page is not up-to-date. Close the page, reopen it, and try again.

Identification fields and values:

Document Type='Order',No.='106010'

 

Now I haven't connect the Automation flow with the approval workflow yet, so now in the sandbox has only a standard approval template workflow.

 

Update:

I changed the trigger OnBeforeAction() to OnAfterAction(). It's working fine for now. Haven't tested it might affect my flow or not since the sandbox doens't have flow yet.

I'll try to make a test flow and see if this is ok to use and update here.

I'm just posting this one for sharing.

but the next question we really can't solve it.


2.
Another issue we have here.
Our planner wants the planning worksheet in dynamics shows the sales order No. if the demand is coming from a Sales Order because the Planning Worksheet indeed is difficult to read when there are tens of lines in there.

We know the Order Tracking line shows the SO No. but it takes too much time.

We have spent days by searching for the way copy the SO No. related in the table but no luck so far.

Perhaps someone knows a simple solution that we couldn't able to imagine.....

Thank you

Joe Kim
joe.kim@alphalabs.co.nz

I have the same question (0)
  • JYKalpha Profile Picture
    2 on at
    Hi, 
    Does anyone know about this?
    especially No.2
     
    Thanks!
  • Inge M. Bruvik Profile Picture
    1,161 Moderator on at
    What exact page is it where you want to display information about the sales order?
    Can you use ctrl+alt+F1 to find the exact page number?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,850 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,045 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans