I want to add the surveyor's username into a field.
How can I pick up the username?
Thanks.
Solved! Go to Solution.
Do something like this:
type | name | label |
username | theusername | Username |
The username question type will capture the currently logged-in user into a field in your layer, but will not be shown in your form. If you want to show the loggedin username into the form, use a note question as shown below:
type | name | label |
username | theusername | Username |
note | Username is ${theusername} |
For completeness, there is an alternative way to get the username using the property('username) function. However, this function only works in the Survey123 field app. At the moment, property('username') does not work in the Survey123 field app.
Hi John,
The using Survey123Connect, the easiest way to do this is to add a field of type username to the survey- the field will not be visible, but will record the username. Refer to the 'Question Types' section in XLSForm essentials—Survey123 for ArcGIS | ArcGIS That being said, Survey123 uses a feature call editor tracking (Editor tracking for feature services—Documentation (10.3 and 10.3.1) | ArcGIS for Server ) that automatically records the username (and date & time) of when a survey is submitted.
Again, thanks for the reply James.
How can I get the Username to display on the survey though?
You can use the property function to access the username if you want it in a visible field - see the 'Device and user properties' section in Prepopulate answers—Survey123 for ArcGIS | ArcGIS
Thanks James.
I tried this but it didn't work -
pulldata("@property", 'username')
how do you put the user name so I can have a message: "you are signed in as" and [esri username]
Hi Peter,
You can have a question of type 'username' and then use that in a calculation.
James,
I don't see a 'username' function under the device and user properties pulldata list. As others note, the username question alone does not display in the survey. I added an additional text question to my survey with a
Calculation: ${username}, but all it returns is "Unknown @property: username". I am logged into AGOL, but testing through Survey Connect with an unpublished survey.
Do something like this:
type | name | label |
username | theusername | Username |
The username question type will capture the currently logged-in user into a field in your layer, but will not be shown in your form. If you want to show the loggedin username into the form, use a note question as shown below:
type | name | label |
username | theusername | Username |
note | Username is ${theusername} |
For completeness, there is an alternative way to get the username using the property('username) function. However, this function only works in the Survey123 field app. At the moment, property('username') does not work in the Survey123 field app.
If the field is turned to readonly=yes, will it appear in the report?