AnsweredAssumed Answered

How do I bring ArcGIS Runtime into Survey123 for named user licensing?

Question asked by mstayner@utilisync.com on Jan 18, 2019
Latest reply on Jan 22, 2019 by ESoekianto-esristaff

Hi AppStudio Team!

 

I need to bring ArcGIS Runtime into Survey123 so I can sync feature services. I saw Erwin answered a similar question previously, but my situation is slightly different, so I thought it would be best to create a new thread.

 

I asked about this over on the Survey123 forum. James Suggested we look at using parallel portal objects. We tried creating a parallel Portal object and we were able to get sync working (yeah!), the only problem is we have to sign in twice - once for the Survey123 portal object and once for the runtime object. 

 

Below is the code we are currently using. We will always be signed into Survey123 and have an Esri user access token when we run sync. Is it possible to create a new portal object using an access token instead of a username and password? 

 

var portal = ArcGISRuntimeEnvironment.createObject("Portal", {url: "https://www.arcgis.com"});
var credential = ArcGISRuntimeEnvironment.createObject("Credential");
credential.username = "[portal username]";
credential.password = "[portal password]";
portal.credential = credential;
portal.loadStatusChanged.connect(function(){
if (portal.loadStatus === Enums.LoadStatusLoaded) {
  var info = portal.portalInfo;
  var licenseInfo = info.licenseInfo;
  // update licence Info
  ArcGISRuntimeEnvironment.setLicense(licenseInfo);
  console.log("licensceLevel after Update:"+ArcGISRuntimeEnvironment.license.licenseLevel);
}

 

Thanks!

 

Matt

Outcomes