New guy here. Having a lot of fun with the API so far. Like most of you, we're developing our own standalone tools, but we're also working to integrate with Softimage. So if any of you are Softimage users, a special shout out to you!
I'm working on tidying up our submitter tool, and one of the things I want to do is update the 'Artist' field on Versions to show the name of the user who is making the submission. By default it inherits the name of the entity who creates it, in this case a Script. I figured I could just push an update to the Artist field, which is internally called 'user', and is an entity. But that's where I'm hitting a snag.
Here's a quick example of what I'm trying to do, in Python:
#My first step is to identify who is using the submitter. I query the Windows Login for that. (Windows Logins match our SG logins)
currentUser = os.environ.get( "USERNAME" )
filters = [
['login','is', str(windowsLogin)]
]
userName = sg.find('HumanUser',filters, ['name'])[0]['name'] #This correctly returns the full name of the artist (i.e. 'Tim Crowson')
#My next step is try and push this to the 'user' field of a Version I have just created (and whose ID I get from the creation process)
data = {
'user': userName
}
update = sg.update('Version', version_id, data)
And this is where the problem is. When I do this, I get an exception: API update() Version.user expected [Hash, NilClass] data type(s) but got String: 'Tim Crowson'
My guess is that it's because I'm trying to pass a string to an Entity field. Do I need a dict instead? Fairly sure it's just a syntax problem, but like I said, I'm quite new to this still.
Not entirely sure what syntax I should be using...