Select to view content in your preferred language

What is the expression to automatically populate a person's name on a field in Smart Form?

1092
4
Jump to solution
09-27-2023 01:34 PM
StaciMcLaughlin
Occasional Contributor

Hello, 

I'm new with configuring Smart Forms, but I am trying to create a calculated expression for an "Inspector Name" field for an asset inspection form I created. I would like to have the inspector's name automatically populate, where it basically pulls from the ArcGIS Account name or their email possiblily.

StaciMcLaughlin_0-1695846690322.png

 

Luckily I was able to figure out the expression to automatically pull in the Inspection date of when the form was complete with the time, but now I need to determine how I can automatically pull in the user name.

StaciMcLaughlin_1-1695846690279.png

 

 

If anyone has any insight or expressions they could share I would appreciate it.

 

Thank you!

1 Solution

Accepted Solutions
JustinReynolds
Frequent Contributor

Hello Staci

These types of functions are pretty well documented here.

The function you are looking for is the GetUser function 
https://developers.arcgis.com/arcade/function-reference/portal_functions/#getuser

 

GetUser()
- Justin Reynolds, PE

View solution in original post

4 Replies
JustinReynolds
Frequent Contributor

Hello Staci

These types of functions are pretty well documented here.

The function you are looking for is the GetUser function 
https://developers.arcgis.com/arcade/function-reference/portal_functions/#getuser

 

GetUser()
- Justin Reynolds, PE
StaciMcLaughlin
Occasional Contributor

This information you provided is very helpful, thank you so much! I reviewed the GetUser function and I feel like I am getting very close. Per my screanshot I attached do you know how I can get it to return the fullname? In the output it's pulling in all my AGOL information in the inspector name field. Thank you again!

0 Kudos
MappyIan
Frequent Contributor

Hi @StaciMcLaughlin, the following will pull back the fullName of the logged in user:

// Returns full name of logged in user
GetUser($layer).fullName

You can just paste that directly in the Calculated expression area in FieldMaps Designer.

Hope this helps.

StaciMcLaughlin
Occasional Contributor

Great, this helped! I used  GetUser(FeatureSetByName($datastore, 'Channel Inspection')).fullname and it worked! Thank you!