How to restrict WORKDATE for several users

MadhanMadhan Posts: 96Member
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 Posts: 7,915Member, Moderator
    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
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting

  • MadhanMadhan Posts: 96Member
    Thanx a lot

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

    For Another developer with same problem.


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


    ==================================
    Richard
  • themavethemave Posts: 1,058Member
    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 Posts: 57Member
    dear kriki,

    Thanks for providing the its working fine.

    Regards,
    Aniruddha
    Thanks & Regards,
    Aniruddha
  • rakesh_raulrakesh_raul Posts: 5Member
    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 Posts: 5Member
    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 Posts: 3,301Member
    Do you make it right, it works too!
  • rjvermarjverma Posts: 25Member
    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 Posts: 7,915Member, Moderator
    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
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting

  • rjvermarjverma Posts: 25Member
    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 Posts: 52Member
    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 Posts: 25Member
    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 Posts: 25Member
    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 Posts: 53Member
    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 Posts: 108Member
    Look at the codeuint 1 and check a workdate on OnGlobalModify|OnGlobalModify|OnGlobalInsert functions.
    NAV and T-SQL Developer.
    Have performance issues?
    Contact me.
  • hery_halimhery_halim Posts: 53Member
    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.