I need help [:0] I need a field automatically filled by the name or account name of the active user that created that record. And I don’t know how to retrieve logged on user info can anyone help me plz. ???
From the C/SIDE Reference Guide (Help menu):
quote:
USERID (Database) Use this function to have the system return the ID of the current user. ID := USERID ID Data type: text constant or code This string contains the ID of the current user. Comments Unless set up otherwise, the system prompts you for a user ID and password when you start the application. This function returns the user ID entered there. Example This example shows how to use the USERID function. User := USERID; MESSAGE(Text000, User);
Create the following text constant in the C/AL Globals window: Text Constant ENU Value Text000 ‘The system was started by %1’ A typical result: The system was started by: JOE
USERID should work fine i think.
Which table this user ID information referes to do you know ?, I thougth it over and it may couse problems to uncover user id instead I would like to user user names I solved it by IF recUser.GET(USERID) THEN Rec."Created By" := recUser.Name;
But I don’t know if this part is necessary IF recUser.GET(USERID) THEN
recUser is a rec variable to User table Thanks for your help[:D]
quote:
Which table this user ID information referes to do you know ?, I thougth it over and it may couse problems to uncover user id instead I would like to user user names I solved it by IF recUser.GET(USERID) THEN Rec."Created By" := recUser.Name;
But I don’t know if this part is necessaryIF recUser.GET(USERID) THEN
recUser is a rec variable to User table Thanks for your help[:D]
Originally posted by EMK - 2004 Dec 14 : 08:39:24
If you are using the native db, then you should find user info on table 2000000002 - User, while if you are using the SQL server option, then you should find a table entitled User [:D]
But Navision also has the Windows Authentication option, in which case the User is stored in Table 2000000054 Windows Login.
quote:
But Navision also has the Windows Authentication option, in which case the User is stored in Table 2000000054 Windows Login.
Originally posted by nelson - 2004 Dec 14 : 10:54:50
I knew I was forgeting something [:o]
I suggest you filter the session table with “My Session”=1, get the “Login Type” (Database or Windows) and then find out which table you should query to (database or windows) and get the name of the user. Remember that when you have windows authentication then the USERID function does not give you the domain, only the user id and you can’t filter properly the “Windows Login” table, so you should get it from the session table, with the 'User ID" field.
Look at this topic: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=9015