Hi,
I try to make a string with the Login-id of an user. I can use USERID, but then I miss the Domain-name, so I came up to the following:
LoggedInAs := (environ('USERDOMAIN') + '\' + USERID) ;
But when I the string is formatted as:
Domain
Username
in stead of
Domain\Username
I know I can use %1 when I show this in a message, but that doesn't seem to work when I try to store it in a global.
Has anyone an idea how I can store a backslash in a string?
0
Comments
You can store Domain\Username in a text-field, global or local. :-k
Tino Ruijs
Microsoft Dynamics NAV specialist
Maybe there is a better way, but I haven't seen one. I can provide you the function if you need it, but it's more fun building it on your own
There is a way.
The way you described shoud work.
LoggedInAs := (environ('USERDOMAIN') + '\' + USERID) ;
If you would show LoggedInAs on a form you would see Domain\Username.
Tino Ruijs
Microsoft Dynamics NAV specialist
LoggedInAs := STRSUBSTNO('%1\%2',ENVIRON('USERDOMAIN'),USERID);
and that seems to work.
@ tinoruijs: You're right, the carriage return is only shown when I show the value with message()
RIS Plus, LLC
Like Daniel said: LoggedInAs := (environ('USERDOMAIN') + '\' + USERID) ; was already working.
Tino Ruijs
Microsoft Dynamics NAV specialist