How to restrict WORKDATE for several users

MadhanMadhan Member Posts: 96
hi all,

Great day to every one.

I like to know whether it is possible to restrict WORKDATE for a particular user. can any one help me how to do this?

For Example

I am having Five users,

In that only two users will be able to change the WORKDATE and the remaining three can not.

Comments

  • krikikriki Member, Moderator Posts: 9,086
    Not so easy, but I have an idea, but I didn't test it:

    Create a singleinstance codeunit. This codeunit you have to launch in Codeunit 1 function LogInStart().

    globals :
    recUserSetup Record "User Setup"
    autTimer  Automation  'Navision Timer 1.0'.Timer (property WithEvents=Yes)
    
    OnRun() of your singleinstance codeunit:
    IF ISCLEAR(autTimer) THEN BEGIN
      CREATE(autTimer);
      autTimer.Interval(3 * 1000); // test each 3 seconds
      autTimer.Enabled(TRUE)
    END;
    CLEAR(recUserSetup);
    IF recUserSetup.get(USERID) THEN ;
    

    autTimer::Timer(Milliseconds : Integer)
    IF TODAY <> WORKDATE THEN
      IF NOT recUserSetup."User May Change WORKDATE" THEN BEGIN
        WORKDATE := TODAY;
        MESSAGE('You may not change the WORKDATE. WORKDATE has been resetted');
      END;
    

    PS : you need to create field recUserSetup."User May Change WORKDATE".
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • MadhanMadhan Member Posts: 96
    Thanx a lot

    I will work on it and update you.
  • ranian92ranian92 Member Posts: 10
    Hi

    For Another developer with same problem.


    http://www.mibuso.com/forum/viewtopic.php?p=52893#52893


    ==================================
    Richard
  • themavethemave Member Posts: 1,058
    Here is a slightly different approach from a non-developer point of view,
    you goal is to not let certain employees post transactions with a different date then "Today" correct.

    So, you need to change the user setup allow to-from posting date to always be today. For this I would create a processing only report that updates the user setup table 91 to have the current date, run the report in the job scheduler or NAS and you are done. I would run this each evening so when the employee came in in the morning they would be ready to go. You filter it to run just on the restricted employees. You could add a field to the user setup table, a check box that you would check if they were restricted.


    dt := TODAY + 1 // today plus 1 if you run it at night for the next day.

    "User Setup" OnAfterGetRecord()
    "Allow Posting From" := dt;
    "Allow Posting To" := dt;
    Modify;
  • aniruddha_majumdaraniruddha_majumdar Member Posts: 57
    dear kriki,

    Thanks for providing the its working fine.

    Regards,
    Aniruddha
    Thanks & Regards,
    Aniruddha
  • rakesh_raulrakesh_raul Member Posts: 5
    IS THERE A WAY TO GET THE SERVER DATE AND PUT THAT DATE IN ALL CLIENTS?
    Regards,



    Rakesh Raul
    Consultant (Sr.)

    Cognatio Systems LLC
    T: +971 4 359 0202 EXT : 404
    F: +971 4 359 0205
    M: +971 52 908 9987
    www.cognatiosystems.com
    Skype ID : RaulRakesh
  • rakesh_raulrakesh_raul Member Posts: 5
    I got solution for SQL DB that i have created one Date field in Company Info Table and written stored procedure in SQL to populate date in to Date field. Executing procedure by using JOBS. Now as suggested by kriki i have written code which is working fine.
    In case of FDB I am using Jog Queue, but I am facing some problem with Job QUEUE.
    Regards,



    Rakesh Raul
    Consultant (Sr.)

    Cognatio Systems LLC
    T: +971 4 359 0202 EXT : 404
    F: +971 4 359 0205
    M: +971 52 908 9987
    www.cognatiosystems.com
    Skype ID : RaulRakesh
  • garakgarak Member Posts: 3,263
    Do you make it right, it works too!
  • rjvermarjverma Member Posts: 25
    Dear Kriki

    I had gone through you Code, but I am not able to configure 2nd line of below code ! Would you help me out to do this.

    recUserSetup Record - I had define the field in User Setup table as well as Singleinstance codeunit as global variable.

    autTimer - where I need to configure autTimer

    Code: Select all
    recUserSetup Record "User Setup"
    autTimer Automation 'Navision Timer 1.0'.Timer (property WithEvents=Yes)


    regds

    Rupesh Verma
    Rupesh Verma
    Floor & Furnishing (I) Pvt. Ltd.
  • krikikriki Member, Moderator Posts: 9,086
    In the global variables of the codeunit, you need to create a variable of type automation and select the Navision timer (you need to have NAV installed in a correct way or otherwise you need to registrate the dll yourself in Windows).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • rjvermarjverma Member Posts: 25
    Hi Kriki

    Thanks for giving us the solutions, you solutions is working fine.
    regds
    Rupesh Verma
    Kortek Electronics
    Rupesh Verma
    Floor & Furnishing (I) Pvt. Ltd.
  • faizguy84faizguy84 Member Posts: 52
    Kriki provided good solution. But still i would go ahead with themave solution with minor modification. Instead of creating a report and running it through NAS , write the same code to update "Allow posting from" and "allow posting to" as today through Application management code unit on LogInStart function. That will make life simple.



    Regards,
    Faisal Bukhari
  • rjvermarjverma Member Posts: 25
    Dear Kriki

    Thanks for giving me the solutions to restrict/allowed the Users to change the Work Date.

    Rupesh Verma
    Rupesh Verma
    Floor & Furnishing (I) Pvt. Ltd.
  • rjvermarjverma Member Posts: 25
    kriki wrote:
    In the global variables of the codeunit, you need to create a variable of type automation and select the Navision timer (you need to have NAV installed in a correct way or otherwise you need to registrate the dll yourself in Windows).


    Dear Kriki

    Thanks for giving me the solutions to restrict/allowed the Users to change the Work Date.

    _________________
    Rupesh Verma
    Kortek Electronics (I) Pvt. Ltd.
    Rupesh Verma
    Floor & Furnishing (I) Pvt. Ltd.
  • hery_halimhery_halim Member Posts: 53
    Hi all,

    I found this thread interesting.

    How can we do that in Navision 2013 ?

    I try to implement this solution in Nav 2013, but soon find out that Navision Timer 1.0 no longer supported.

    Any updates ?

    Thanks
  • rmv_RUrmv_RU Member Posts: 119
    Look at the codeuint 1 and check a workdate on OnGlobalModify|OnGlobalModify|OnGlobalInsert functions.
    Looking for part-time work.
    Nav, T-SQL.
  • hery_halimhery_halim Member Posts: 53
    Hi rmv_RU,

    I can't find anything related to OnGlobalModify|OnGlobalModify|OnGlobalInsert functions in codeunit 1?

    any clue ?

    thanks
Sign In or Register to comment.