Reputation: 61
I have been trying to update a nested object using simple_salesforce
specifically been trying to update the Owner
field in a Case
object.
from simple_salesforce import Salesforce
sf = Salesforce(username = 'username',password = 'password',security_token='security_token', sandbox = False)
sf.Case.create({'Description':'stuff in description','Owner':'Owners User'})
Whenever I try to insert I get the following error:
Response content:
[{u'errorCode': u'INVALID_FIELD', u'message': u'The value provided for foreign key reference Owner is not a nested SObject'}]
Please any help would be appreciated.
Upvotes: 6
Views: 2122
Reputation: 1
I had the same issue with setting the Opportunity RecordType - I was trying to use the "text" of the Type name. However, you have to pass the 15 digit SF name of the Record Type, to find that, you need to go to SETUP, Opportunities, RecordTypes, click Edit by your record type, and in the URL you will see a the value:
The value you pass in the above example is: '01215000001UUtL'
Your Simple-Salesforce Call would look like:
sf.opportunity.create({'RecordTypeId':"01215000001UUtL",'AccountId':SFaccountId,'CloseDate':SFcloseDate,'StageName':'Closed Won','Name':'OPPORTUNITY NAME'})
Upvotes: 0
Reputation: 644
I ran into this same error and it turns out you have to use the OwnerId
field and pass the Id of the owner.
Upvotes: 4