2

The Bulk API's upsert requires an external ID field name, I presume to act as the unique identifier which says whether a record you're upserting exists or not (determining whether to insert or update).

Is it possible for this external ID (a primary key, of sorts) to be multiple fields, so that the combo of those fields must be unique?

Example:

Existing records:

{'CarType': 'Van', 'Color': 'Yellow', 'Price': 14}
{'CarType': 'Sport', 'Color': 'Red', 'Price': 50}

Upserting

{'CarType': 'Sport', 'Color': 'Green', 'Price': 65}

would insert a whole new record, because no existing records have both a 'CarType' of 'Sport' AND a 'Color' of 'Green'.

Upserting

{'CarType': 'Sport', 'Color': 'Red', 'Price': 65}

would NOT create a brand new record, and would update the 'Price' of the existing red sports car to be 65.

1 Answer 1

3

According to your requirement, Create a text field which will be unique and External Id.

This field will have value with a combination of Car Type and Color.

And that will decide whether existing records to be inserted or updated.

If you have old records then you need a data migration to populate this field value.

After that, you will do insert/upsert based on Bulk API.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .