Options

Customized code in Codeunit 1

ta5ta5 Member Posts: 1,164
edited 2012-03-13 in NAV Three Tier
Hello
We have a strange behaviour in Codeunit 1.
Function LoginStart:
IF GUIALLOWED AND NOT ISSERVICETIER THEN BEGIN
  //something
end;

This works like charm but if a classic report without rtc layout is started in rtc then "something" should not run. Any ideas how to change the code?
Btw: The "something" is a modal form that shows db name, servername, etc.
Thanks in advance.
Thomas

Answers

  • Options
    deV.chdeV.ch Member Posts: 543
    Made a short test, when the classic client is loaded for report displaying of not converted reports, the Application Name in the session table shows: "111"
    So maybe you could get your session record (set filter to "My Session" = true) and check if appliation name = '111'
  • Options
    ta5ta5 Member Posts: 1,164
    Hi Dev.CH
    Thanks for reply. Good point, I already knew that, but for different reasons I'd rather would not use session table (problems in some versions if user has only rights for some companies)...
    Any other ideas?
    Thanks
    Thomas
  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    may i know what is your requirement?

    If you want to show server name and database name..you can use system indicator functionality in NAV 2009 R2..
  • Options
    ta5ta5 Member Posts: 1,164
    may i know what is your requirement?

    If you want to show server name and database name..you can use system indicator functionality in NAV 2009 R2..
    good point, but system indicator is for rtc only, isnt't it?
  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    ta5 wrote:
    may i know what is your requirement?

    If you want to show server name and database name..you can use system indicator functionality in NAV 2009 R2..
    good point, but system indicator is for rtc only, isnt't it?

    yes..exactly
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    ta5 wrote:
    good point, but system indicator is for rtc only, isnt't it?
    You're right. System Indicator will work only for RTC.
    Which build of Nav are you using?
    ~Rik~
    It works as expected... More or Less...
  • Options
    ta5ta5 Member Posts: 1,164
    ta5 wrote:
    good point, but system indicator is for rtc only, isnt't it?
    You're right. System Indicator will work only for RTC.
    Which build of Nav are you using?
    2009R2 Build 32012
  • Options
    ta5ta5 Member Posts: 1,164
    Btw: Why does IsServiceTier does not help?
  • Options
    SogSog Member Posts: 1,023
    Because classic reports run on rtc, but don't fall under "isservicetier"
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Maybe someone from MS can comment:
    a) why Application Name in the Session table is set to '111', when executed through RTC to run classic reports
    b) is there another way to distinguish if LoginStart in Codeunit 1 is executed through RTC to run classic reports
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    deV.chdeV.ch Member Posts: 543
    Hmm have you tried to add permission at the object level to ensure session table is accessible?
  • Options
    ta5ta5 Member Posts: 1,164
    deV.ch wrote:
    Hmm have you tried to add permission at the object level to ensure session table is accessible?
    I'll try, but as said before, my primary goal was not to use session at all, because it's a special table and generally not used similar on all versions and platforms.
    Thomas
  • Options
    deV.chdeV.ch Member Posts: 543
    Yeah i understand that, but i guess since your request ist very special, you can be happy that there is at least ONE way to do this. But who knows...
  • Options
    ta5ta5 Member Posts: 1,164
    It works like this:
    Session.SETRANGE("My Session",TRUE);
    Session.FINDFIRST;
    IF Session."Application Name" = '111' THEN
      EXIT;
    

    Thanks for all of the contributions
    Thomas
  • Options
    pdjpdj Member Posts: 643
    If you get permission problems, you should just grant SELECT permissions to the Session view for the $ndo$shadow application role... (Assuming you are using Standard security)
    Regards
    Peter
  • Options
    worthowortho Member Posts: 23
    Hi,

    The solution has been provided already. Here are my answers to your question:

    a) The Application Name is set to 111 to avoid consuming another Client session when we launch Classic Client to run a Classic report from RTC.
    b) There is no other way to determine if the Classic Client is being launched by RTC to run a report.

    Regards,

    David
    “This posting is provided "AS IS" with no warranties, and confers no rights.”
Sign In or Register to comment.