Hi,
I want to fetch Unique Primary Key of the Record (Sales Invoice No.), for a selected record from Sales Header Table & Pass it as a parameter to Power Automate flow. I got an error it shows only last record ID but I want to fetch Sales Invoice No for a selected record. Please Provide Any suggestions so that I can fetch particular record NO. from sales header table.
Thank You.
Thank you For suggestion It works Perfectly.
Ok I got it what you mean now.. you forgot to set TableNo property in your codeunit.. by setting the TableNo property, using a global variable, and passing the CurrentRecord as a parameter in your codeunit, you can get the selected current record invoice number in your page.
codeunit 50129 INK_GetPostURL { TableNo = "Sales Header"; // set the TableNo property trigger OnRun() begin SalesHeaderCurrentRecord := Rec; MyProcedure(); end; local procedure MyProcedure() var errors: Record "Error Message" temporary; SalesHeder: Record "Sales Header"; SalesHeaderNo: Code[20]; begin SalesHeaderNo := SalesHeaderCurrentRecord."No."; // If your requirement is only to get the selected invoice number you don't need to use set filter in your MyProcedure() to get the current record.. // SalesHeder.SetFilter("Document Type", '=%1', "Sales Document Type"::Invoice); // SalesHeder.SetFilter("No.", '=%1', SalesHeaderCurrentRecord."No."); // 'INV-1089801' your invoice number // if (SalesHeder.Find('-')) then begin // SalesHeaderNo := SalesHeder."No."; // end; end; var SalesHeaderCurrentRecord: Record "Sales Header"; // Sales Header Record variable for current record } // in your action you need to pass the current record as a parameter. FlowTest.Run(Rec);
Please make sure you adjust the code with the appropriate logic and filters according to your requirement
Regards
I have try For Static Record , I need help for a selected record in whole page dynamics in AL Code .
Pass SalesHeader parameter to MyProcedure.
procedure MyProcedure(SalesHeader: Record "Sales Header") responsetext: text
make it global by removing local infront of the procudure
you dont need lines 31 to 42 in the MyProcedure
You can use SalesHeader parameter that is passed to function in your code.
call the procedure from your page action
Storetext := FlowTest.MyProcedure(Rec);
Storetext is text variable to store the responsetext
If you want to fetch a specific Sales Invoice No., you need to specify the invoice number you want to fetch. I don't have information about the parameters or criteria you want to use to fetch the current record or a specific invoice number..
SalesHeder.SetFilter("Document Type", '=%1', "Sales Document Type"::Invoice); SalesHeder.SetFilter("No.", '=%1', 'INV-1089801'); // 'INV-1089801' your invoice number if (SalesHeder.Find('-')) then begin SalesHeaderNo := SalesHeder."No."; end;
Please make sure to modify the code with the appropriate invoice number or criteria according to your requirement.
Regards
Yes , if there is a way to do ,Can you please watch in these community I mention a whole code below and I want to fetch the "Sales invoice No." for a selected Record.
I have Upload the Full code Below in my Community Page.
Code Unit
Page Ext
Hi,
I have not seen from where you are calling this Myprocedure function. Can you show your complete code here?
This is because you are iterating through all the invoices and at the end, you are getting the last invoice number to your variable SalesHeaderNo
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156