Select to view content in your preferred language

Survey123 web - accessing external web services

4 weeks ago
New Contributor II


I am working on a survey form that uses pulldata(@javascript) to access a csv attachment of turning points and send it to an API to convert the coordinates from various coordinate systems to lat long and do a few other things. The API returns a JSON that we then use in the survey123 form, using pulldata(@json), to populate questions.

It works fine in connect and the field app but we need it to work in Survey123 web and it just returns a blank. 

The first issue I found was that we were using pulldata(@javascript) to get the url for the csv attachment in the portal, which works. However for some reason we can't use the outputs of a field calculated with a pulldata(@javascript) function as input to a calculation for another field. This only happens in the web app.

I got around that by getting the url and sending it to the API in the same javascript function, but survey123 web then doesn't return the JSON returned by XMLHttpRequest. The URL is correct, ive tested it in the browser and it returns the JSON, and it works in connect and the field app, just not in survey123 web.

Does anyone have any idea why this happens and/or what I can do to make it work or get around it? Javascript is below, I am on version 3.19 of Connect. Here is the error i can see in the console :



Alternatively does anyone know how to use the outputs of one pulldata(@javascipt) field in the calculation for another field? Creating another field, copying the response and setting it as a string does not work. If we could do this I could set the form up differently and not use the API.



function createJSON(service, featureLayer,where, token) {


//var debugmode = false;

var xmlhttp = new XMLHttpRequest();

var csv = getRecord(featureLayer,where,token)

var url = service + "?attachment=" + csv


if (token){

url = url + "&token=" + token;




return xmlhttp.responseText;


0 Kudos
0 Replies