Skip to main content

Notifications

Announcements

No record found.

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

Work Description-type field on Purchase Order email?

(1) ShareShare
ReportReport
Posted on by 130
I am trying to add a blob field on the PO Page and then include it in the PO Report so that the value can show on the email as text. I have taken the Work Description field from the Sales Quote & Sales Order tables/pages/reports as inspiration, copying and adjusting the files in the extension. However, when attempting to use the send email function, the output value is not in the correct format.
 
Any ideas?
 
Field on PO page
 
Field value output upon Send Email action, from the PO report
 
 
Code below
 
Categories:
  • Suggested answer
    Tonya Profile Picture
    Tonya 16 on at
    Work Description-type field on Purchase Order email?
    Hi there! 
    You are definitely on the right path! 

    The first thing I want to address is why your code isn't working. When you tried to "output" the Work Description to the report, you gave your dataset the encoded blob. You need to utilize the code inside the GetWorkDescription procedure to decode the blob into a text field. 

    If you look at your page extension, you use a text variable for WorkDescription, and OnAfterGetRecord() you populate the variable from the table by calling Rec.GetWorkDescription()
     
    So using that same logic on your report, you will want to create a variable of type text. 
    In the OnAfterGetRecord() of the Purchase Header, I would first clear your variable, then do the same code that you used on the page. 
    You don't need to recreate those procedures on the report since they already exist at the table level. 
    Your final product should look something like this. 
     
    reportextension 70100 "TBM_StandardPurchaseOrder" extends "Standard Purchase - Order"
    {
        dataset
        {
            add("Purchase Header")
            {
                column(TBM_WorkDescription; WorkDescriptionVar) { }
            }
            modify("Purchase Header")
            {
                trigger OnAfterAfterGetRecord()
                begin
                    Clear(WorkDescriptionVar);
                    WorkDescriptionVar := TBM_GetWorkDescription();
                end;
            }
        }
     
        var
            WorkDescriptionVar: Text;
    }

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,253 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans