I'm trying to automate the approval request process by allowing users to send several request at time, but when they select some purchase invoices the request is sent only for one of them.
Is there any option to do it?
Thank you
Hello,
I've this code:
var
PurchHdr: Record "Purch. Inv. Header";
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
PurchHdr.Copy(Rec);
CurrPage.SetSelectionFilter(PurchHdr);
if
PurchHdr.FindSet() then
repeat
SendApprovalRequest(PurchHdr);
if ApprovalsMgmt.CheckPurchaseApprovalPossible(Rec)
then
ApprovalsMgmt.OnSendPurchaseDocForApproval(Rec);
until
PurchHdr.Next() = 0;
end;
but I got this error 'Action SendApprovalRequest' cannot be used like a method
Thanks
Here is a sample you can adopt to your needs which is on a different page. You’ll need a variable for Purchase Header table. Add the below snippet to a new page action in a page extension for the list page of the purchase invoices
PurchHdr.Copy(Rec);
CurrPage.SetSelectionFilter(PurchHdr);
if PurchHdr.FindSet then
repeat
SendApproval(PurchHdr);
//copy the standard function call
until PurchHdr.Next = 0;
Thank you, I'll try to do it the way you tell me even though I'm not an expert.
No you would need a custom feature. You have to use a selectionfilter so you can determine which records are selected and then you loop through those. You could have a custom processing only report to do a similar task too.
Sohail Ahmed
999
YUN ZHU
934
Super User 2025 Season 1
Mansi Soni
612