Dynamic SourceTableView for MenuSuite Pages

KarlRhodesKarlRhodes Member Posts: 37
edited 2014-11-17 in NAV Three Tier
I have a page that displays expense header records in a list and depending on the user opening the page, different record sets need to be displayed. For instance, when a finance user opens the page, they may wish to see items with a status of "Submitted" or "Approved", but when a manager opens the page, they will need to see claims that have a status of "Pending Approval".

Currently I am creating multiple pages to display data from the same table, but would like to know if I can filter this data before the page is opened, IE setting the SourceTableView depending on who opens the page.

I have added my pages to the MenuSuite and these display exactly as I expect in the RTC. However, maintaining multiple pages that will essentially be performing the same tasks and displaying the same (or very similar data - just filtered differently) is a pain and I wondered if there was any way of pre-filtering the data? It certainly doesn't look like you can from the MenuSuite.

Please understand I am new to NAV development so I appreciate your patience.

Thanks,
Karl

Comments

  • KowaKowa Member Posts: 923
    KarlRhodes wrote:
    It certainly doesn't look like you can from the MenuSuite.
    That's right, but instead of calling the page directly from there you can call a function in a codeunit (or any other object type where you can write C/AL), which will evaluate the role of the user, apply SETTABLEVIEW according to the role and call the page afterwards.
    Prior to the advent of MenuSuites in version 4, menus were created using Forms, and you could place your code in the OnPush event of the button, but the MenuSuites did not retain this possibility.
    Kai Kowalewski
  • KarlRhodesKarlRhodes Member Posts: 37
    Thank you Kai,

    I will take the CodeUnit approach.

    I don't mean to open a debate on the subject, but I do find it a little strange that this feature, the ability to set the Source table view, is not available. I suspect this has something to do with licencing and the objects in them.
    Looking into the CodeUnit method it would appear I would need a codeunit for each view too.
  • KishormKishorm Member Posts: 921
    You can set your required filters in the OnPageOpen trigger. You should use FILTERGROUP to make sure that the user cannot clear/override the filters you are setting.
Sign In or Register to comment.