Hi BC Community,
I would like to email an entire POs lines to a user.
I can populate a list to include all lines, however, I can not figure out how to email this list using strsubstno.
The current issue is that even though I include the listdata variable into the StrSubstNo function, in AddBodyMessage that element is blank, and subsequent email text is blank.
My code below:
if userEmail <> '' then begin
purchaseLine.SetRange(purchaseLine."Document Type", PurchaseHeader."Document Type");
purchaseLine.SetRange(purchaseLine."Document No.", PurchaseHeader."No.");
if purchaseLine.FindSet() then begin
repeat
listData.Add(purchaseLine.Description);
counter := counter 1;
until purchaseLine.next = 0;
end;
BodyMessage := 'Dear %1,
%2 has been fully approved.
Vendor:%3
Total($):%4
%5';
subjectMessage := 'Your request %1 has been fully approved';
AddBodyMessage := StrSubstNo(BodyMessage, userName, purchaseHeader."No.", purchaseHeader."Buy-from Vendor Name", purchaseHeader.Amount, listData.GetRange(1,listData.Count));
addUserSubject := StrSubstNo(subjectMessage, purchaseHeader."No.");
EmailMessage.Create(userEmail, addUserSubject, AddBodyMessage, true);
Thanks as always