Form Calculate GetUser() Offline

6992
39
04-21-2022 10:56 AM
CraigCheeseman
Regular Contributor

Has anyone had success calculating the username when offline?  Documentation says I should be able to use the layer.  Works testing but does not work in app.

var u = getUser($layer);
var fullName = u.fullName;
return fullName;

39 Replies
ElleniFRogers
Emerging Contributor

Hi @CraigCheeseman

Hmm, that is strange. I can confirm I turned my phone to airplane mode, switched off wifi and cellular and it still works on the downloaded map. When I used $layer it didn't work, but by switching to the FeatureSetByName function it did. Can you paste your code with the FeatureSetByName function?

Elleni

0 Kudos
by Anonymous User
Not applicable

I also see it work offline and disconnected. Nice idea @ElleniFRogers  !

GetUser(FeatureSetByName($map, 'GetUserTest')).username

I also just tested an internal build that addresses the $layer issue, and that also works fully disconnected.

0 Kudos
CraigCheeseman
Regular Contributor

Thanks Aaron, good to know.  I am on Android so I am having my iOS users test as this still only works when connected for me. 

0 Kudos
CraigCheeseman
Regular Contributor

Ok.  Thanks for confirming.  I used your code with obviously updating "Feature" to the correct value from my map.  I will double check that I didn't do anything wrong but it did return the correct value when testing in the Web Editor.  Just to confirm are you using Enterprise or AGO?

0 Kudos
by Anonymous User
Not applicable

@CraigCheeseman  It works for me in Android 22.1.2 and iOS 22.1.0 when using ad-hoc offline areas and being full disconnected.

0 Kudos
CraigCheeseman
Regular Contributor

Screenshot_20220428-094709_Field Maps.jpg

Ok and this is using Enterprise or AGO?  I am using AGO.  This is my code:

GetUser(FeatureSetByName($map,"NameOfLayerInForm")).fullname

and I am still seeing the red error when disconnected.

22.1.2 version as well.  This is really frustrating.  It works connected and then as soon as I disconnect it stops working and then if I reconnect it still will not work until I restart the app and reload the map.

CraigCheeseman
Regular Contributor

@Anonymous User I verified with my field team that it didn't work for us on iOS either.  Can I share the map and data with you to see if it works for you?

0 Kudos
by Anonymous User
Not applicable

@CraigCheeseman  We're looking into this more, there's definitely something weird going on at least in some cases. I was able to reproduce the issue where it fails to calculate when disconnected. Sometimes even if I use a FeatureSet it fails just by using an offline area even though I'm still connected. I don't think it's necessary to share the map at this time since we have a map that reproduces it.

0 Kudos
CraigCheeseman
Regular Contributor

Thanks and good to know I am not crazy.  I have pulled this from deployment testing and will wait to hear back. 

0 Kudos
DebHSF
by
Regular Contributor

@Anonymous User Is there any update on this?

I'm using GetUser(FeatureSetByName($map,"NameOfLayerInForm")).fullname and it's not working even when I download a map for offline use (i.e. still connected to the internet, but offline map downloaded).

Using AGOL and Field Maps v 22.2.1 on Android.