Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Salesforce by (11.9k points)

I'm trying to upsert a record via the salesforce Beatbox python client the upsert operation seems to work fine but I can't quite work out how to specify an externalid as a foreign key:

Attempting to upsert with:

consolidatedToInsert = []

for id,ce in ConsolidatedEbills.items():

    consolidatedToInsert.append(

        {

            'type':'consolidated_ebill__c',

            'Account__r':{'type':'Account','ETL_Natural_Key__c':ce['CLASS_REFERENCE']},

            'ETL_Natural_Key__c':ce['ISSUE_UNIQUE_ID']

        }

    )

print consolidatedToInsert[0]

pc.login('USERNAME', 'TOTALLYREALPASSWORD')

ret = pc.upsert('ETL_Natural_Key__c',consolidatedToInsert[0])

print ret

gives the error:

'The external foreign key reference does not reference a valid entity: Account__r'

[{'isCreated': False, 'errors': [{'fields': [], 'message': 'The external foreign key reference does not reference a valid entity: Account__r', 'statusCode': 'INVALID_FIEL D'}], 'id': '', 'success': False, 'created': False}]

The soap examples and the specificity of the error text seem to indicate that it's possible but I can find little in the documentation about inserting with external ids.

1 Answer

0 votes
by (32.1k points)
edited by
As of now, Beatbox doesn't support serializing nested dictionaries like this, which is needed for the externalId resolution you're trying to do. (If you look at the generated request, you can see that the nested dictionary is just serialized as a string)).

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...