Home > Development, VB .Net > Obtaining Username in form script

Obtaining Username in form script

October 24th, 2011 Leave a comment Go to comments

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

ScreenHunter_04 Mar. 21 10.29

  1. cgkeller
    March 21st, 2014 at 10:51 | #1

    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!

  2. admin
    March 21st, 2014 at 11:43 | #2

    Hi cgkeller,
    Please see updated post with sample screen shot.@cgkeller

  3. cgkeller
    March 21st, 2014 at 13:09 | #3

    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!

  4. CWiens
    October 17th, 2014 at 13:10 | #4

    Perfect solution, thanks!

  5. bluedream118
    June 3rd, 2015 at 01:39 | #5

    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?

  1. No trackbacks yet.
You must be logged in to post a comment.