Obtaining Username in form script
In syteline 7 it was SessionManager.BaseUserName.
In Syteline 8
- Create form component ‘UserEdit’ and bind it to variable ‘User’ with initial value ‘USERNAME()’
- Get the value on form script by ‘ThisForm.Variables(“User”).Value’
This will return the UserID who login to Syteline. - Use System.Environment.UserName to get the UserID login to Windows.
Here is a sample screen shot
I am trying to retrieve the userid as described in this article, but when I enter USERNAME() in the Initial Value box, it changes it to a Literal (~LIT~(Username |-)). Which obviously populates the edit box with “Username |-“. Is there another way to get the UserID? I would like to have it automatically populate in a form. Thanks!
Hi cgkeller,
Please see updated post with sample screen shot.@cgkeller
Found that it doesn’t matter if it displays ~LIT~(Username |-) because once it’s run, it will update that value to ~Lit~. But it is important that you use all caps on USERNAME. Thank you for the post!
Perfect solution, thanks!
Thanks for the sharing. I have another question regarding the form script. As you know, there is a way to get the component name, but not the binding property name.
Can I get the binding property name for the components?