Select to view content in your preferred language

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

2580
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
1 Solution

Accepted Solutions
LaurenBoyd
Esri Contributor

Hi Matt,

Did you license your application with the Named User license or are you inputting the Lite license key? To take advantage of the Named User license, you will need to access the LicenseInfo from the Portal and use this to license the application before any ArcGIS Runtime code is called.

You can find more information and a sample of this workflow at the following link under the License your app with a Named User account section: License your app—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

If you have done the above and you are obtaining the license from the Named User, only a login that is a level 2 named user has the sync capabilities. You would need to login as a level 2 Named User in an ArcGIS Online organization or on-premises Portal. This would give you a Basic license and you could then synchronize edits to feature geometry, attributes, and attachments from a mobile geodatabase to a feature service. Lite licenses cannot synchronize edits, they can only download updates from a sync-enabled feature service to a mobile geodatabase.

Please take a look at the Licensing Capabilities page for more information.

Hope this helps!

Lauren

View solution in original post

11 Replies
LaurenBoyd
Esri Contributor

Hi Matt,

Did you license your application with the Named User license or are you inputting the Lite license key? To take advantage of the Named User license, you will need to access the LicenseInfo from the Portal and use this to license the application before any ArcGIS Runtime code is called.

You can find more information and a sample of this workflow at the following link under the License your app with a Named User account section: License your app—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

If you have done the above and you are obtaining the license from the Named User, only a login that is a level 2 named user has the sync capabilities. You would need to login as a level 2 Named User in an ArcGIS Online organization or on-premises Portal. This would give you a Basic license and you could then synchronize edits to feature geometry, attributes, and attachments from a mobile geodatabase to a feature service. Lite licenses cannot synchronize edits, they can only download updates from a sync-enabled feature service to a mobile geodatabase.

Please take a look at the Licensing Capabilities page for more information.

Hope this helps!

Lauren
MattStayner
Frequent Contributor

Hi Lauren,

Thanks for the info and the quick response!

I didn't realize there was an option to license our application with the Named User license. I checked out the link you sent and it looks pretty straight-forward. After the user signs in with their portal named user, then we can use info.licenseInfo and ArcGISRuntimeEnvironment.setLicense(licenseInfo) to license our application with the Named User license. Then, as long as the user is level 2 Name User, they will have access to the "Basic" level capabilities (sync, add, delete, edit). Did I get that right?

Thanks,

Matt

0 Kudos
LaurenBoyd
Esri Contributor

Hi Matt,

Exactly! Once they successfully log in as a level two named user and you grab and save the license info, they should be good to go with editing a syncing!

Lauren
0 Kudos
MattStayner
Frequent Contributor

Hi Lauren,

The named user licensing sounds perfect, but I'm having some issues accessing portal.portalInfo. For testing purposes, I created a new app using the Survey123 template. I added the following lines to the onSignedInChanged

function (see attached for the modified file).

console.log("Signed in!");
console.log("portal:"+portal);
console.log("portal.portalInfo:"+portal.portalInfo);
console.log("portal.portalInfo.licenseInf:"+portal.portalInfo.licenseInf);‍‍‍‍

And below is what I'm getting in the log:

portal.portalInfo is undefined. It appears that portal is a string and not a JSON object. What am I missing?

Thanks,

Matt

0 Kudos
MattStayner
Frequent Contributor

Is anyone else having this issue where portal.portalInfo is undefined? I'm confused. I would have thought portal would be a big JSON object, not a string like is shown above. I must be missing something.

0 Kudos
ThomasDunn
Deactivated User

Matt,

How did you create the portal object? Did you declare it or create it in a function? I'm wondering whether the portal object was loaded after creation. See Portal QML Type | ArcGIS for Developers about the portInfo property.

TAD

0 Kudos
MattStayner
Frequent Contributor

Hi Thomas,

I am just trying to use the Survey123 template. With the code for that app, it looks like the portal object is created on line 503 of SurveyApp.qml (see the file I uploaded previously and below).

Portal {
  id: portal
  ...
  onSignedInChanged: {
  ...
    if (signedIn) {
      userInfo = portal.user;
      writeUserInfo();

      console.log(qsTr("Signed in!"));
      console.log("Signed in!");
      console.log("portal:"+portal);
      console.log("portal.portalInfo:"+portal.portalInfo);
                
      console.log("portal.portalInfo.licenseInf:"+portal.portalInfo.licenseInf);

      ArcGISRuntime.license.setLicense(portal.portalInfo.licenseInfo)
    }
  }
}
‍‍‍‍

There is a function onSignedInChanged (see line 536) inside Portal. I'm just really confused with the object portal. When I use console.log to view portal, I just get a string. But when I use portal.user, it returns the user information. However, portal.portalInfo is undefined.

So, I have 2 questions. 

  1. What is up with the portal object? Why do I get a string with console.log("portal:"+portal) but I get an object with 
    console.log("portal:"+portal.user).
  2. Shouldn't portal.portalInfo be defined in the code block above? What am I missing?

Thanks,

Matt

0 Kudos
ThomasDunn
Deactivated User

Matt,

I recommend that you avoid using console.log alone to output the content of objects as a whole. This will only work with console.log happens to do the right thing, and you won't know for sure that it worked because you don't know how the object was converted to a string. In this case, the output string seems to be an internal-use string representing that object instance.

It's best to take complete control and be explicit in type conversion to strings. For objects that have a property containing its JSON representation, you can use console.log(JSON.stringify(myportalobject.json)). For objects that don't have a JSON representation, you can console.log a member of the object, appropriately converting to a string before using it in console.log.

TAD

0 Kudos
MattStayner
Frequent Contributor

I just can't figure out if portal is an object or a string. Let me show you what I mean.

Below is what I put into the S123 app:

console.log("Signed in!");
console.log("portal:"+portal);
console.log("portal JSON:"+JSON.stringify(portal.json));
console.log("portal.user:"+JSON.stringify(portal.user));
console.log("portal.portalInfo:"+portal.portalInfo);

Here is what shows in the log:

When I try to stringify portal, I get undefined, but when I stringify portal.user I get an object. That doesn't make any sense to me. If portal.user contains information, then portal should be an object, right? What is going on?

Would it be helpful if I shared the entire codebase so you could run it yourself? It is simply the Survey123 template with the console.log added to onSignedInChanged in SurveyApp.qml.

0 Kudos