Options

Change Role Centre for Web Client

thegreenleprechaunthegreenleprechaun Member Posts: 5
edited 2014-12-04 in NAV Three Tier
All,

Can we programmatically change the Role Centre of a user when he logs in from a Webclient.

A role centre for RTC and a different role centre for Web Client for the same user. We can know where user has logged in from is querying the Active Sessions table.

Client wants user to only enter their Expenses using Webclient and for everything else use RTC.

I have patrolled almost all blogs and topics on this website but no concrete solution without having to restart the application.

Anythingg else that the learned people around here can share.

Thanks

Comments

  • Options
    JuhaJuha Member Posts: 39
    You could change the Profile ID on User Personalization during login depending on the Client Type in Active Session. When user log in on web you set Profile ID to the WebProfile else you set Profile ID to the users default profile.

    /Juha
  • Options
    thegreenleprechaunthegreenleprechaun Member Posts: 5
    Tried that already before I posted the query.

    On Application Management , DefaultRoleCentreID get a called only if there is no default role centre assigned.

    Next I tried the LoginManagement Codeunit, because surely this codeunit needs to be called to login, where it checks if Profile.Is Empty I wrote code to change the role centre ID but by the time application application loads it has grabbed the Role Centre id already. However, if I close and restart the browser it now takes the correct role centre.

    Hence my original question, a solution where I won't have to restart the application.

    Thanks
  • Options
    JuhaJuha Member Posts: 39
    The role center is determined by the Profile ID in User Personalization, so changing the Profile ID in LoginManagement LogInStart works.
    It will however mess up your User Personalization table, as Profile ID will show the profile used at last login. You can add a new field “Default Profile ID” to User Personalization and show the new field in the user personalization pages and remove the standard Profile ID field.

    Create a function ChangeProfileID like this:

    ActiveSession.GET(SERVICEINSTANCEID,SESSIONID);
    UserPersonalization.GET(ActiveSession."User SID");
    IF ActiveSession."Client Type" = ActiveSession."Client Type"::"Web Client" THEN
    UserPersonalization."Profile ID" := 'WEB' <- REPLACE WITH THE PROFILE FOR WEB
    ELSE
    UserPersonalization."Profile ID" := UserPersonalization."Default Profile ID ;
    UserPersonalization.MODIFY;

    And call it in start of LogInStart. You will now use the profile WEB when logging in with web client and the default profile with other clients. No restart needed.
    /Juha
  • Options
    thegreenleprechaunthegreenleprechaun Member Posts: 5
    Thanks Juha,

    Let me explain with screen shots what i meant by restarting the application. Please see attached screenshot.

    Areas in Red - Description of the Role Centre Page
    Areas in Green - Action Items for the Role Centre.

    Step 1. - Change the code. View variables, everything is perfect. Role Centre when coming from Web is set ot Expense. As expected, Fantastic.

    Step 2.- Open browser. try the webclient. It opens the Expense Role Centre which is NOT the default role centre on User Personalization. Fantastic, Code change worked.

    Step 3. Open RTC to check which role centre it picks up, should not be EXPENSE but the default one. Now, we have a problem, Even though the Description says "Lease Mgmt." the Action items are from the Expense Role Centre.

    Step 4- Close RTC and Open it again. Restarting the RTC application - This time it gets the right Role Centre and the Correct Action Items on the left.

    Everytime henceforth it opens the RTC fine but for the first time even though it gets the Default Role centre right it gets the action items from the Web Role centre.

    Somewhere it doesn't refresh completely on its own but restarting the RTC fixes it.

    Thanks
  • Options
    JuhaJuha Member Posts: 39
    Hmm.. I didn't notice that the action items wasn't correct, sorry.
    Strange that the RTC loads the action items before knowing the profile. If you don't have any profiles in the database they will be inserted in LogInStart.
    I have tried to delete all profiles, and when I start RTC it open the correct role center with correct action items.
    So I guess it's not possible to do what you want.
    /Juha
  • Options
    thegreenleprechaunthegreenleprechaun Member Posts: 5
    I thought so, just wanted to get an opinion here before i gave up.

    I have raised it with Microsoft using our Advisory Hours and hoping to hear from them by next week. I will update the post here if they come up with a "Solution"

    The fact that, as you said, that RTC loads the action items before knowing the profile seems very odd. There is no concept of STX file anymore so i can't say that it took it from there, There is User Metadata table but that is user personalization only, so i don't know where does it get the action items from a different profile.

    I will update if i hear anything from MS.

    Thanks for your time.
  • Options
    SilverXSilverX Member Posts: 134
    It seems that the only way to accomplish this is Dynamics NAV 2015 Web Client, using the Profile URL Parameter to specify the Profile to use. Changing this on-the-fly in CU1 is not working, as some Settings are already done when launching CompanyOpen().

    Check out the following page: How to: Open the Microsoft Dynamics NAV Web Client.
    Cheers
    Carsten


    ==> How To Ask Questions The Smart Way

    This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
Sign In or Register to comment.