Select to view content in your preferred language

Seems like GetEnvironment() is crashing out in Field Maps?

685
6
11-08-2024 11:48 AM
DougBrowning
MVP Esteemed Contributor

Cannot even get GetEnvironment()  to run.  If its blank that is fine but it just fails totally.

Is this not support yet?

thanks

6 Replies
KerriRasmussen
Esri Contributor

Hi Doug,

Good afternoon. Where are you using GetEnvrionment()? Can you give some more context on how you are trying to use the function? 

Thanks,

Kerri

DougBrowning
MVP Esteemed Contributor

I was helping a user that wanted to use line breaks.  Since NewLine does not work in Field Maps you use <br/>.  But then that is ugly in map viewer.

So I helped them write code using GetEnvrionment() and it works great in the map.  But in Field Maps it says expression failed.  We also tested GetEnvrionment() for IsEmpty and "" but it just fails right away.  So my guess is Field Maps GetEnvrionment() is not set supported.  

Arcade still has no try except (which it really should) so that is about as far as we can test.

Is GetEnvrionment() supported in Field Maps?

thanks

KerriRasmussen
Esri Contributor

Good Morning Doug,

Currently the GetEnvironment() function is not supported in ArcGIS Field Maps, however it will be supported in future releases of the software. I do want to thank you for sharing your use case, this helps us while we develop the software. Keep an eye on the What's New Blog for Field Maps for when Runtime 200.2+ is supported.

Thank you,

Kerri

DougBrowning
MVP Esteemed Contributor

Thanks the user ended up changing to an Arcade box and doing all HTML which works in both.

DougBrowning_0-1731425525612.pngDougBrowning_1-1731425538060.png

 

TL2
by
Frequent Contributor

Is there a workaround to this?  To know you are in field maps and not the web?

TracyLove
Emerging Contributor

Yes a reliable way to determine context is needed.  getenvironment has been available for about 2 years now.  kinda telling that this has not been solved after all these years.  

//my hack way to try to figure out if we are online or in field maps
var PointGeometry = Centroid(Geometry($feature));
var ArcadeSr = PointGeometry.spatialReference.wkid;
var application = ArcadeSr
if (ArcadeSr == 102100) {
application = 'AGOL online edit'
} else if (ArcadeSr == 3857) {
application = 'GPS in FieldMaps'
}

0 Kudos