conditional drilldown

gulamdastagirgulamdastagir Member Posts: 411
calling all nav gurus
Suppose there are 2 fields on a card 1.Category 2.Inventory , "Category" has two values A or B ,Inventory is a flowfield which drills down to show ledger entries.I want the drill down to work only when the Category =A and not when Category=B
Regards,

GD

Comments

  • gulamdastagirgulamdastagir Member Posts: 411
    on Form-OnAfterGetCurrRecord()
    IF "Category"='B' THEN CurrForm.Inventory.ENABLED:=FALSE ELSE CurrForm.Inventory.ENABLED:=TRUE;
    Regards,

    GD
  • bbrownbbrown Member Posts: 3,268
    Write a custom drilldown using the form's OnDrillDown trigger.
    There are no bugs - only undocumented features.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    What happens if the user changes the Category. You will need to put code in the onvalidate trigger. BBrown solution is far better.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • gulamdastagirgulamdastagir Member Posts: 411
    sample 1.
    IF "Item Category Code"<>'MISC' THEN
    BEGIN
    ILE.SETFILTER(ILE."Item No.","No.");
    ILE.SETFILTER(ILE."Global Dimension 1 Code","Global Dimension 1 Filter");
    ILE.SETFILTER("Global Dimension 2 Code","Global Dimension 2 Filter");
    ILE.SETFILTER("Location Code","Location Filter");
    ILE.SETRANGE("Drop Shipment","Drop Shipment Filter");
    ILE.SETFILTER("Variant Code","Variant Filter");
    ILE.SETFILTER("Lot No.","Lot No. Filter");
    ILE.SETFILTER("Serial No.","Serial No. Filter" );
    frmILE.SETTABLEVIEW(ILE);
    frmILE.RUN;
    END
    ELSE  ;
    

    This works fine but this Restriction is only for the "End Users" but the "Managers" want to see the Item Ledger Entries for all Item Categories i.e this restriction should not apply to them.


    I started with
    1.Creating a user called MISCUSER in SQL SERVER 2005 and then Synchronized the Users from NAV CLIENT.
    2.Created a new ROLE called MISC ROLE and copied all the permissions from the "SUPER" Role except for the Table "Item" where i first tried to make the Permission as "Blank" and then "Indirect".
    3.Wrote the Following code
    sample 2.
    SETPERMISSIONFILTER;
    
    If READPERMISSION THEN
    
      MESSAGE('You have some read permissions to item.')
    
    ELSE
    
      MESSAGE('You have no read permission to item.');
    
    

    4. I was expecting for the MISCUSER login when i run the item card it should show me MESSAGE('You have no read permission to item.');
    but it shows
    MESSAGE('You have some read permissions to item.')

    5.So i tried to Syncronize ALL Logins i get an error "229,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server] Select permission denied on object '$ndo$usrproperty',databse 'demo',schema 'dbo'"

    6.Iam trying to accomplish this scenario
    when Manager logs in he can see the item card and he can change the item category code and drill down on inventory
    but the "end users" down should be restricted as shown in code sample 1 above


    Any help much appreciated ,thanks!
    Regards,

    GD
  • gulamdastagirgulamdastagir Member Posts: 411
    any experts with NAV security? :roll:
    Regards,

    GD
  • DaveTDaveT Member Posts: 1,039
    Hi

    What security filter did you set?

    Which record are you using for readpermission?
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • gulamdastagirgulamdastagir Member Posts: 411
    I have given a detailed step by step account of what i did.

    This is the first time iam implementing NAV security thru code. My understanding of NAV security is very poor so please help me out experts!

    thanks
    Regards,

    GD
Sign In or Register to comment.