Arcade Function to Detect Browser vs Mobile app

366
1
12-14-2022 07:42 AM
Status: Open
JCGuarneri
Occasional Contributor II

I would love if there were Arcade functionality to detect what platform a user was accessing a map from so that derived content could be displayed accordingly. My particular use case is creating links to access Cityworks items for field and office users. Field users would be looking at the map in Field Maps and use a URL to open it in the Cityworks Mobile app. Office users would view the map in Portal or a web app, and use a different URL to open in Cityworks Office.

Currently, I have to create two links in the same map (some potential for confusion) or maintain separate maps for field and office users (more work). Having a way to tell if the user is in Field Maps or a browser would allow me to tailor the experience to the user with less maintenance.

Screenshot 2022-12-14 103014.png

In practice, it would be great to be able to write it something like this:

 

var urlFormat1 = "some:\\format\"
var urlFormat2 = "https:\\anotherFormat\"

\\get environment
var env = GetPlatform()
\\build URL accordingly
if(env = "Mobile"){
return urlFormat1 + $feature.InspectionID
}
else{
return urlFormat2 + $feature.InspectionID
}

 

 

1 Comment
ArmstKP

@JCGuarneri Could you acquire the username and then build the URL depending if the user is a field worker or office staff?