Survey123 - Is it possible to use custom javascript functions when working offline?

1290
5
06-25-2020 07:17 AM
TrevorHobbs
New Contributor II

Hi,

Our field crews are using an iPad with Survey123 v. 3.9.149.  When traveling into areas of poor cell coverage, users are automatically logged out.  This disables custom javascript extensions that I have created for certain fields.  As such, they are not able to use the survey in an efficient way.  I've read all of the GeoNet posts regarding this issue, and most suggest upgrading to the latest version.  Since we are using the latest version (as of the date of this question), this doesn't seem to be the correct solution.  Is it possible to use javascript extensions when working offline?  Wouldn't the javascript function be stored locally in a separate .js file (on the iPad) along with the survey, when downloaded to their device?  

I've attached the Survey project in a zip file (including the extensions folder), if that would be helpful to troubleshoot.

Thank you!

Trevor

0 Kudos
5 Replies
by Anonymous User
Not applicable

Hi Trevor,

Yes, it is possible to use custom JS function whilst offline, provide the user is signed in (need to be signed in before going offline).

We had some issues with 3.9 and earlier with users being unexpectedly signed out when going into areas of poor coverage or restarting the app between being online and offline. These issues have been addressed in 3.10, which will be released soon, so you should see custom JS functions working offline provided they are signed in at least once before going offline. Also, custom JS functions are not fully supported in the field app and web app in 3.10.

Regards,

Phil.

0 Kudos
TrevorHobbs
New Contributor II

Hi Phillip,

So my iPad has new release 3.10.323 installed…  I’ve been using it for about a week or so and… while there are some nice new features, this issue with the javascript hasn’t been solved .  There doesn’t even seem to be a “grace period” for being signed in.  As soon as my device is offline, I’m instantly signed out of AGOL and the extensions are disabled.

Any advice? 

0 Kudos
by Anonymous User
Not applicable

Hi Trevor,

 

Can you please expand on the workflow and steps from downloading survey, opening, going offline etc? Does this happen on all devices and for all surveys and users? Are you going offline while the app is open, or when the app is closed? Using flight mode vs just being in an area with no networks? Are you using Wifi or 4g/3g before going offline?

 

With 3.10 a lot of work went into ensuring the user should not get logged out automatically when offline or changing networks, they should stayed logged and can continue to use Survey123 in that state. You will notice this change with the new start screen and login screen that allows you to continue even when offline. You can test this with the username question and see if the value of their username gets populated when they open a form.

 

Regards,

Phil.

0 Kudos
Ming
by
Occasional Contributor

Hi @Anonymous User ,

We are using latest Survery123 v3.12.230. We have used JavaScript to query and update online feature services with user input data in Survey123 form.

You mentioned that it is possible to use JavaScript while offline provide the user is signed in. So do you have any sample code to query and update the layer in the downloaded offline map, then can sync back to server when it's online? We did a lot search but couldn't find any sample.

Thanks!

0 Kudos
by Anonymous User
Not applicable

Hi @Ming,

It is not possible to updated the downloaded offline map package and update it via a JavaScript function. Whilst JS functions can work offline, they are not designed to be allowed to modify local files in other locations on the device. Also the offline map packages in Survey123 do not sync back to the ArcGIS server, they are just downloaded for read only purposes.

Regards,

Phil.

0 Kudos