Introduction:

Here, the scenario is, I open a Purchase order and add Items to it. When I select on an Item I want to know the Purchase History of it like the Receipt quantity, Posting date etc.

Yes,.. I know what your guessing, simply create a Factbox for it . But…now I want the Top 5 history of the Item not all of it . Lets find how to do this.

Pre-requisites:

Microsoft Dynamics NAV

Steps:

  1. Create a Query. Here, I have a custom table used in the Query. you can use Item Ledger Entry DataItem  for fetching the history also in the Properties I’ve set the Order by for posting date as Descending.

Query

order

2. Create a table with the fields you want.

table

3. Create a List Part Page with Source Table as the table created above and Set SourceTableTemporary as yes. When this property is yes then the table doesn’t use Customer Licence. so yay! this table is free.

Page1

4. Now create a Part page in the Purchase Order (Pg No. 50). Here set the Provider ID to 60 to set the link the custom table Query Inv GRN field Item No to Purchase Line field No.

link

5. Create a function in TestPage and call it on the OnFindRecord trigger

trigger

6. Here, I’ve used Query to setrange with the Item No fetched and set TOPNUMBEROFROWS as 5. this will fetch only the top 5 Item’s history

funct

That’s it! Enjoy your day!

download