Select to view content in your preferred language

What Runtime license level do I need to sync edits for named users?

2572
11
Jump to solution
01-02-2019 01:07 PM
MattStayner
Frequent Contributor

I was told I would need "Basic" Runtime license level unless I used Esri named users. I am authenticating using Oauth2 and Esri named users, but when I try to run the code below, I get an error message,

"Attempt to use functionality that is not supported for the current license level".

My current license level is "Lite". Shouldn't I be able to sync with "Lite" using named users?

Thanks,

Matt

function executeSync(databasename,index) {
      resultProgress.value = 0;
    var content=layersModel.get(index);
    var synctaskid=content.layerId+"_syncTaskId";
    var x=content.layerUrl.substring(content.layerUrl.lastIndexOf("/"));
    var featurelayerid=x.replace("/","");
    var Urlsplitted=content.layerUrl.replace(content.layerUrl.substring(content.layerUrl.lastIndexOf("/")),"");
    syncLayerOptions.layerId=featurelayerid;
    var newObject1=ArcGISRuntimeEnvironment.createObject("Geodatabase", {id:"gdb",path:outputGdb+"/"+databasename,serviceUrl:Urlsplitted});
     var newObject2=ArcGISRuntimeEnvironment.createObject("GeodatabaseSyncTask", {id:synctaskid,url:Urlsplitted});
    syncJob =newObject2.syncGeodatabase(syncParameters, newObject1);
    delay(1000, function() {
        if (syncJob) {
            syncWindow.open();
               simpletimer.start();
          resultProgress.value += 1.0;
            syncJob.credential.token=app.portal.token;
            syncJob.jobStatusChanged.connect(updateSyncJobStatus);
            simpletimer.running=false;
            simpletimer.stop();
            syncJob.start();
        } else {
            syncWindow.open();
            statusText = "Sync failed";
            syncWindow.hideWindow(5000);
            console.log("sync else");
        }
    });

}
Tags (2)
0 Kudos
11 Replies
by Anonymous User
Not applicable

Hi Matt.

Possibly the confusion here is that Survey123 doesn't actually use the Runtime Portal object, instead they have created a custom QML file called Portal.qml which handles all the requests/logins etc to AGOL/server etc.

If you look in the Survey123 code, there is a folder called Portal which contains a file called Portal.qml, which is the "portal" that it uses. This "portal" does not have a json representation, nor does it have a "portalInfo" property, which means that what you see being logged out to the console makes sense.

What you were probably expecting was the Portal object from the Runtime, as per this documentation link:

Portal QML Type | ArcGIS for Developers 

This is the "portal" object you should be using if you wish to license your app for the Runtime. (Note that I don't think it has a json representation either, although it does have the portalInfo property you are looking for).

So, for your testing, you should probably use a different code base/sample to start with. Possibly the OAuth sample, or the "Portal User Info" sample?

cheers

-Paul

0 Kudos
MattStayner
Frequent Contributor

Paul,

Yes! That is what I was missing. Survey123 doesn't use the Portal Runtime object. I switched to the sample "Portal User Info" and it worked great. If anyone is curious, below is the code I used:

Portal {
    id: portal
    credential: Credential {
        oAuthClientInfo: OAuthClientInfo {
            oAuthMode: Enums.OAuthModeUser
            clientId: "T3Gjh6a2d0MK14ke"
        }
    }

    Component.onCompleted: load();

    onLoadStatusChanged: {
        if (loadStatus === Enums.LoadStatusLoaded ) {
            console.log("**************** Signed in! ****************")
            console.log("license level before: "+ArcGISRuntimeEnvironment.license.licenseLevel)
        }

        if (loadStatus === Enums.LoadStatusFailedToLoad)
            retryLoad();
    }
}

Which resulted in:

License level 2! Just as I was hoping.

Thanks for everyone for helping with this!


Matt

0 Kudos