Using $username in Pages

v2.12.5 Using IIS

Anyone able to pass $username off to a script using Pages? I see the variable when going to edit, can use it 50% of the time in the form display but never to pass it to the script.

Steps to reproduce:

  1. Create simple test script to take in username and write-host
param($username)
write-host "username is $username"
start-sleep -Seconds 5
  1. Create a Test Page
  2. Create a simple form, link the button to the script and put $username as the title, create a hidden username field with default value of $username. Ensure it allows you to see output of the script.
  3. Go to the page.
    4a. If I refresh 10 times, 50% of the time I’ll see my domain\user there.
  4. Click submit
    5a. At no point do I see my username pass through.
    image

I’ve tried latest version of v3 and still getting the same problem when running scripts.

Additional notes:

  • Passing $username to API seems to work
  • Using $username in the page title or description will show undefined most of the time, even though I’m authenticated. Refreshing will sometimes bring up the right username
  • Passing $username in to a script never works.