Adding user info in the Attribute Table

526
4
09-26-2018 12:25 PM
GiatriLalla
New Contributor III

Good Day,

I would like some advice please. I want to store the app user's name/info in the feature service table when a feature is added. This is simply so that I can identify who added the feature to the table. How can this be done? I have tried adding information using Secure Storage and then retrieving the info to be stored as the attribute but that did not work.

Thank you in advance.

Tags (2)
0 Kudos
4 Replies
ErwinSoekianto
Esri Regular Contributor

Giatri, 

First of all, this functionality can be easily done by enabling editor tracking in the feature layer.

But if you prefer to do this manually, you can just include the user information in the appropriate fields in your feature layer, just like when you are adding other information to the feature layer.

What exactly did not work in your attempt? What's the error message? 

Thank you,

Erwin

GiatriLalla
New Contributor III

Hi, thank you for the reply. I was not aware of the editor tracking I will take a look at that. Can you further explain the manual method? Thank you.

Also,

there's no error message, what I did was include this piece of code 

retrieveData.text = qsTr("Value: ") + SecureStorage.value(key.text)

in this part of the Add Features Code:

// create attributes json for the new feature

var featureAttributes 

 

 

0 Kudos
ErwinSoekianto
Esri Regular Contributor

The "manual method" is just simply adding another field(s) to your feature layer, then when you do addFeature or applyEdit, make sure to include that new information to the new field(s). 

I think you meant to show more code in your previous comment? 

0 Kudos
GiatriLalla
New Contributor III

I enabled the editor tracker as well and I was able to see who is making an edit (in this case it was me) however majority of the app users will be the general public with no ArcGIS Online account. Would I still be able to see who added a feature?