Forum Discussion
AndrewRost
13 years agoCommunity Member
Retrieve LMS User Name as Variable
I know you can have a user fill in a text box with their name and then later use that variable for personalization. What we would like to do is programmatically retrieve the user name from the LMS....
SteveFlowers
10 years agoCommunity Member
It works everywhere I've tried it. Yes, it should work.
However, since triggers work in order but JS runs asynch, If you're doing something that relies on the setting of the variable, you'll want to be sure you load in the name from the LMS with a bit of time to spare. You could also add something to your JS to trigger an "It's loaded" pseudo-callback to make sure it has time to load if you're using it to make something else happen.
In most cases, it's just a matter of loading into a variable reference. Which shouldn't make any difference. Shouldn't need a callback in that case.
Tanmay's issue was likely the script bombing out somewhere. Unsure since I don't see an example that wasn't working:)
Steve