Change profile based on Client Type

SteveKnott
Member Posts: 49
Client wants to use a different role centre / profile (i.e. a heavilly simplified) etc when connecting via phone ( mostly to do approvals ), but have a full profile via the web client. This didnt sound like it would be hard to do... but I am struggling.
Code like the below works on a normal action... but I want it to happen automatically when they open the phone client.
If I subscribe to any of the events in System Initialization or Company triggers - Business Central just "hangs".
I thought perhaps it was a loop - but I dont hit this in the debugger more than once... if I try it in the web, it just gets stuck on "Getting ready".
Appreciate any thoughts or if there is a different / better way ?
local procedure OnCompanyOpenCompleted()
var
ClientTypeManagement: Codeunit "Client Type Management";
ClientType: ClientType;
SessionSettings: SessionSettings;
begin
ClientType := ClientTypeManagement.GetCurrentClientType();
if ClientType = ClientType::Phone then begin
SessionSettings.Init();
if SessionSettings.ProfileId <> 'SALES' then begin
SessionSettings.ProfileId := 'SALES';
SessionSettings.RequestSessionUpdate(false);
end;
end;
end;
Code like the below works on a normal action... but I want it to happen automatically when they open the phone client.
If I subscribe to any of the events in System Initialization or Company triggers - Business Central just "hangs".
I thought perhaps it was a loop - but I dont hit this in the debugger more than once... if I try it in the web, it just gets stuck on "Getting ready".
Appreciate any thoughts or if there is a different / better way ?
local procedure OnCompanyOpenCompleted()
var
ClientTypeManagement: Codeunit "Client Type Management";
ClientType: ClientType;
SessionSettings: SessionSettings;
begin
ClientType := ClientTypeManagement.GetCurrentClientType();
if ClientType = ClientType::Phone then begin
SessionSettings.Init();
if SessionSettings.ProfileId <> 'SALES' then begin
SessionSettings.ProfileId := 'SALES';
SessionSettings.RequestSessionUpdate(false);
end;
end;
end;
0
Answers
-
I think a nice approach would be to actually send a link for this user to have on their home screen (or on their browser favorites), to have the full URL for the Web Client that includes the Profile in it.
Example:
https://businesscentral.dynamics.com/Production/phone?profile=ACCOUNTANT
This link forces BC to open the Phone client (even if running from a desktop browser), and it also starts with the ACCOUNTANT profile.
This way, you could have multiple links to different clients/profiles, and users can add as a link to their home screen, or they can save in notes somewhere.Marcelo Borges
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com0 -
Thanks for the idea.. will give that a try...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions