GetUser() When Offline and Disconnected

697
2
03-07-2023 09:22 AM
DanielMiranda2
Occasional Contributor

I have seen a few discussions about GetUser() not working when using Field Maps in a disconnected environment:

Form Calculate GetUser() Offline - Esri Community

Some discussion above was a bit muddled because not everyone was tested in a disconnected environment. Ultimately, no solution worked while offline.

Solved: Field Maps, Offline Map, Arcade Calculation Expres... - Esri Community

BUG-000155887: Arcade expressions fail to calculate when using offl.. (esri.com)

The two above links seem to suggest that this is in fact, a bug that may be addressed down the road.

Has anyone come up with a way to get the current user's information in Field Maps when offline? Or do we have to wait until a bug fix/enhancement is released? 

The only workaround I could think of was to use editor tracking fields, but these fields are not populated until after a data point is collected. So form calculations needing this information will not have it unless the user re-edits the newly added point. This is not a great solution.

When we use Field Maps, many users like to create IDs in their data that includes their initials. This should be easily automated.

 

2 Replies
DanielMiranda2
Occasional Contributor

I have done some more research into this and believe I have found a more viable solution.

What specifically does not work when offline is:

 GetUser($layer).fullName

 Using firstName or lastName also does not work. When I checked the Field Maps mobile app error log, the actual error for the Arcade expression is "field_not_found."

So clearly, a user's full name is not part of the dictionary returned by GetUser. So instead, I tried the following:

GetUser($layer).username

I figured, the editor tracking fields clearly have access to usernames, so maybe GetUser() does too. This DOES work while offline. When I say offline I mean my device is in airplane mode and I am using either an offline area created on the device, or an offline area created in Field Maps Designer. I tested both.

 

In my specific case, our organization uses first initial and last name as part of their usernames, so I can still get the information I want. I won't mark this as a solution though, as it is not quite as good as retrieving a full name. I also find it frustrating that this is not documented anywhere in the Field Maps references or the Arcade reference.

DougBrowning
MVP Esteemed Contributor

They said at Dev Summit that full name does not work yet since it is not part of the offline info and they are working to find a way to support it.