USERID not returning value

lloydflloydf Member Posts: 73
I have added a userid field to the comment line table so that I can store the userid of the user who added the comment.
I ammended the SetUpNewLine function however the USERID function does not return any value.
Any advice as to how I may acheive this would be much appreciated.

SetUpNewLine()
CommentLine.SETRANGE("Table Name","Table Name");
CommentLine.SETRANGE("No.","No.");
CommentLine.SETRANGE(Date,WORKDATE);
IF NOT CommentLine.FIND('-') THEN BEGIN
Date := WORKDATE;
UserID:=USERID;
END

Comments

  • ara3nara3n Member Posts: 9,256
    Navision is not case sensitive. So USERID is interpreted by the compiler as UserID field from Rec.
    I suggest changing the field to "User ID". Notice the blank space before ID.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • DenSterDenSter Member Posts: 8,305
    I'm surprised that it doesn't error out when you try to assign a system variable.
  • kinekine Member Posts: 12,562
    The field name has higher priority than Keyword it means that it is assigning the field into itself, not the system variable into system variable... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MarcTMarcT Member Posts: 1
    Use:
    UserID:=DATABASE.USERID;
    
  • ara3nara3n Member Posts: 9,256
    It's bad practice to name fields after reserved words. Standard Navision uses "User ID". I would rename the field.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SavatageSavatage Member Posts: 7,142
    ara3n wrote:
    Navision is not case sensitive. So USERID is interpreted by the compiler as UserID field from Rec.
    I suggest changing the field to "User ID". Notice the blank space before ID.

    "User ID" := USERID;

    That's what we use too.
    I just seems logical that this be standard.
    I know you can Zoom, but why?

    In fact we've added
    Enabled	Field No.	Field Name	Data Type	Length	Description
    Yes	50001	User ID	Code	20	
    Yes	50002	User Name	Text	30
    

    Why look at the code when you can see the name O:)
    Here's an easy one MS Forum Members! :mrgreen:
Sign In or Register to comment.