User Running NAS

LnZLnZ Member Posts: 37
Hi, I'm trying to save the User Id of the user running NAS on insert and modify triggers on a table field.
I use this simple code
FIELD:=USERID
but it seems to work only on the insert trigger.
Anyone had the same problem?
How I can view the content of a global variable like USERID?
Thanks for your help

Answers

  • krikikriki Member, Moderator Posts: 9,120
    It works also on the OnModify-trigger, but of course the trigger must be launched.
    In code this only happens by doing a INSERT(TRUE) or MODIFY(TRUE). If you don't specify TRUE or specify FALSE, the triggers are not launched.

    To show USERID:
    MESSAGE('USERID=%1',USERID);
    If you put it in the NAS (and the NAS is a service), you will find this message in the eventlog of Windows.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • LnZLnZ Member Posts: 37
    I'm looking at the code at the Web application and it calls all th triggers with NAS using TRUE.
    Maybe there is an error in the XML passed to NAS.
    Thank You for yor reply
  • DenSterDenSter Member Posts: 8,307
    That code works wherever you write it. Of course to see the user id the code has to be executed first :).

    You probably already know this, it is not enough to write "Field := USERID", you also have to MODIFY the record for the value to be written to the database.
  • LnZLnZ Member Posts: 37
    Yes that is obviously, it was a only a problem of object cache.
    Solved it setting the cache to zero.
    Thanks to all for the help
  • krikikriki Member, Moderator Posts: 9,120
    LnZ wrote:
    Yes that is obviously, it was a only a problem of object cache.
    Solved it setting the cache to zero.
    Thanks to all for the help
    Putting the object cache to 0 will slow down everything a lot on that client!
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • LnZLnZ Member Posts: 37
    The object cache was the one of the web applcation and NAS service, yes it slow down everything but since I'm developing on it I need to set it like this for testing.
    When the development is finished everything came as normal.
  • DenSterDenSter Member Posts: 8,307
    You know you don't need to set the object cache to 0 if the problem that you are having relates to NAS not picking up new development. What you need to do is restart NAS every time you save objects and it will pick up the new version. It works the same as a regular NAV client.

    For development purposes though you should consider running your NAS code from a regular client for testing and using NAS itself only when you reach milestones in your development.
  • LnZLnZ Member Posts: 37
    You are completely right but at the time of the test on the server there wasn't a client for running the NAS manually.
    I will follow your directions and install one for testing purpose.
    It is my fault that I didn't explained the architecture in advance.
    Sorry
    Thanks for your help
Sign In or Register to comment.