Any way to get/calc Windows current user with Attribute Rules?

1148
5
11-30-2020 11:34 AM
Alex_Reid
New Contributor III

Hello! We currently have Attribute Assistant calculating last_editor with the CURRENT_USER value of 'U' (windows login) and I'm trying to figure out how to do the same in Attribute Rules in Pro.

I know I could enable Editor Tracking, but that won't help us as our enterprise geodatabase is connected to with database authentication using one connection file, so everyone ends up showing up as 'company_editor'. We need to be able to know the editor was 'user1' 'user2' etc.

Any leads, tips, tricks, etc?

Tags (2)
0 Kudos
5 Replies
JohnBrodnicki
New Contributor III

I submitted an idea similar to this back in April. The status is "In production plan". Not sure how long it will take to get it into a release but it was great news to see that ESRI is working on it. Here is the link to the idea: https://community.esri.com/t5/arcgis-pro-ideas/add-ability-to-access-the-current-user-name-in-arcade...

Alex_Reid
New Contributor III

Thanks for sharing! I didn't find your idea when googling - there's so many ways to word these ideas and questions. I'm pleased it's in the product plan also. We just ended up making several database users and doing editor tracking on one of the databases, but we aren't ready to do that for all 12 of them and would prefer to be able to use our standard method involving usernames. I hope it is enacted soon.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @Alex_Reid  and @JohnBrodnicki ,

 

Please have a look at the post by @HusseinNasser2 explaining new functionality released in Arcade version 1.12 (available in ArcGIS Pro 2.7)

https://community.esri.com/t5/attribute-rules-videos/use-the-getuser-arcade-function-to-return-the-c... 

0 Kudos
Alex_Reid
New Contributor III

Hi XanderBakker, thanks for the reply. I saw that but I guess I wasn't clear enough in my question - we need the computer user/Windows login, not the ESRI user. The Arcade still doesn't appear to be able to get the computer user, unless I'm not understanding how to ask it to do so.

LeonS
by
Occasional Contributor III

I found this to work if you are connecting to the database through windows authentication.  I use this track changes in just geometry.  If everyone is connecting using DB authentication with the same credentials, then this probably less useful.  I don't see anything in Arcade that will get the Windows OS credentials.

 

// Using Pro 2.7
var pFS = FeatureSetByName($datastore, "dbname.owner.dataset")
var pUser = GetUser(pFS).username

 

It looks like at Pro 2.8 you will be able to simplify this to :

var pUser = GetUser($featureSet).username

 

0 Kudos