Hi Everyone,
[In Nav 2009]
I would like to catch current record from sales order Page. I wrote codeunit and I put this in custom button in sales order page.I am able to call that codeunit after clicking the custom button, but I am not able to get current Field value('No' field from Header).
Below is my codeunit, please guide me to get the current record.
Codeunit:[var: CurrentPage-Sales Order]
Salesheader.RESET;
Salesheader.SETCURRENTKEY("Document Type","No.");
Salesheader.SETRANGE("Document Type",Salesheader."Document Type"::Order);
CurrentPage.SETTABLEVIEW(Salesheader);
MESSAGE(Salesheader."No.");
Thanks,
Mani.
0
Answers
Salesheader.GET(CurrentPage."Document Type",CurrentPage."No.");
MESSAGE(Salesheader."No.");
Thanks for reply,
How "CurrentPage" will take Field value(Document Type and No.),CurrentPage(SALES ORDER- PAGE) is page.From current "Sales order" page only i want to catch any field.
Please check and guide me further.
Thanks,
Mani.
Please guide me related to above query.{Get the any field value from current form}
Thanks,
Mani.
SalesHeader.RESET;
SalesHeader.COPYFILTERS(Rec);
CurrPage.SETSELECTIONFILTER(Rec);
Message('%1',SalesHeader."No.");
Thanks
Divyesh Chitte
Thanks for the reply. As you suggest to use SETSELECTIONFILTER for the page,I am not able to add that function.{And, I am using: Rec-SalesHeader}.
Please check once and guide me further.
Thanks,
Mani.
Only if you called the page yourself, using a variable of type page, you may get the current record after the page has been closed (that is, the record that last was current) using On a Page with a subpage you can use the same kind of code using the subpage control.
SETSELECTIONFILTER sets a filter, and can only be used from within the page. It is only able to find the current record if no record is selected or exactly one record is selected. If you are within the page, Rec is your current record at all times.