Modify standard Role Center management in NAV 2017

gianpgianp Member Posts: 36
Hi All.
In NAV 2016 I have customized the standard management of Role Center; In Codeunit 1 I changed function DefaultRoleCenter to get a different DefaultRoleCenterID depending of User or Company. In NAV 2016 this work fine. I porting the same code in NAV 2017 but not work! The custom code not have any effect.
Someone have any idea on what cause this?
Thank's so much.
Gianp.

Comments

  • guidorobbenguidorobben Member Posts: 157
    can you share the code you used?
  • gianpgianp Member Posts: 36
    Buttom the customized DefaultRoleCenter function that work fine in NAV 2016.

    DefaultRoleCenter() : Integer

    { commented standard code - start
    DefaultRoleCenterID := ConfPersMgt.DefaultRoleCenterID;
    OnAfterGetDefaultRoleCenter(DefaultRoleCenterID);
    EXIT(DefaultRoleCenterID);
    commented standard code - stop }

    // custom code - start
    User.RESET;
    User.SETRANGE(User."User Name",USERID);
    IF User.FINDFIRST THEN BEGIN
    IF COMPANYNAME = 'MASTER' THEN BEGIN
    DefaultRoleCenterID := 50039;
    OnAfterGetDefaultRoleCenter(DefaultRoleCenterID);
    EXIT(DefaultRoleCenterID);
    END ELSE BEGIN
    AgicUserPersonalizzation.RESET;
    AgicUserPersonalizzation.SETRANGE(AgicUserPersonalizzation."User SID",User."User Security ID");
    IF AgicUserPersonalizzation.FINDFIRST THEN BEGIN
    Profile.GET(AgicUserPersonalizzation."Profile ID");
    DefaultRoleCenterID := Profile."Role Center ID";
    OnAfterGetDefaultRoleCenter(DefaultRoleCenterID);
    EXIT(DefaultRoleCenterID);
    END;
    END;
    END;
    // custom code - stop
  • guidorobbenguidorobben Member Posts: 157
    1. I would subscribe to the OnAfterGetDefaultRoleCenter(DefaultRoleCenterID) function.
    2. Did you use the debugger to step into the code. The code is only triggered if the User.findfirst is a success.
    3. Which one doesnt work? Master or the other one?
  • gianpgianp Member Posts: 36
    1. I would subscribe to the OnAfterGetDefaultRoleCenter(DefaultRoleCenterID) function.
    -- > I dont understand that you are telling me.
    2. Did you use the debugger to step into the code. The code is only triggered if the User.findfirst is a success.
    --> Yes I debugger right
    3. Which one doesnt work? Master or the other one?
    --> The role center that system load is standard Default Role Center and not the Role Center in the customized code. The code are not effect: its like the customization are not present...
  • guidorobbenguidorobben Member Posts: 157
  • gianpgianp Member Posts: 36
    Thaks for video, I will see it asap. Only one consedation: I have no problem whit NAV 2016... the problems are on NAV 2017!
  • guidorobbenguidorobben Member Posts: 157
    codeunit 1 is sinlge instance. restart nav server.
Sign In or Register to comment.