Options

Dynamics Nav 2013 - Prevent user from clearing the filter

parambparamb Member Posts: 85
edited 2013-12-10 in NAV Three Tier
Hi All,

I have added code to restrict users from viewing/accessing Sales Orders in the Page 9305-Sales Order List based on the Salesperson/Purchaser code in the Sales Order. Each user is assigned a Salesperson in the User setup page. All is fine and the Sales Order List display only the expected sales orders.

But the user can now clear the page filter and see all the sales orders irrespective of the coded filter. I would like to know how can I restrict users with certain rights from clearing the filter.

Comments

  • Options
    whitaker_timwhitaker_tim Member Posts: 23
    In the code behind set a FILTERGROUP before setting the required filter, with a filter group the user cannot remove the applied filters. Check out the online help for more details http://msdn.microsoft.com/en-us/library/dd338919.aspx.
    Tim Whitaker | Senior NAV Consultant/Developer | The Software Workshop Ltd. | http://www.thesoftwareworkshop.com
  • Options
    KishormKishorm Member Posts: 921
    In the code behind set a FILTERGROUP before setting the required filter, with a filter group the user cannot remove the applied filters. Check out the online help for more details http://msdn.microsoft.com/en-us/library/dd338919.aspx.

    As above, just remember to set the FILTERGROUP back to 0 after setting your filters.
  • Options
    parambparamb Member Posts: 85
    Thanks to all who posted reply.

    is it Ok to use the FILTERGROUP(2) and FILTERGROUP(0) one after the other in same trigger.

    The following code is from Std Nav 2013.

    IF UserMgt.GetSalesFilter <> '' THEN BEGIN
    FILTERGROUP(2);
    SETRANGE("Responsibility Center",UserMgt.GetSalesFilter);
    FILTERGROUP(0);
    END;

    I have placed my new code just below this code

    IF UserSetup.GET(USERID) THEN BEGIN
    IF UserSetup."Salespers./Purch. Code" <> '' THEN BEGIN
    FILTERGROUP(2);
    SETRANGE("Salesperson Code",UserSetup."Salespers./Purch. Code");
    FILTERGROUP(0);
    END;
    END;
  • Options
    whitaker_timwhitaker_tim Member Posts: 23
    It is ok to use more than one filter group but you should be using a filter goup higher than 6 as 0-6 are reserved for use by NAV. See the remarks section of the online help http://msdn.microsoft.com/en-us/library/dd338919.aspx.
    Tim Whitaker | Senior NAV Consultant/Developer | The Software Workshop Ltd. | http://www.thesoftwareworkshop.com
Sign In or Register to comment.