-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error during upsert on identical DeveloperName for RecordType of same sObject #3702
Conversation
…for the same SObject type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM , just add that testcase with same developername.
Added test for upsert to check same DeveloperName but different IsPersonType on the RecordType
Fixed an error where if org has no person account enabled then IsPersonType column does not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix will resolve the duplicate record insertion issue when PersonAccount is enabled on the org and duplicate entries of PersonAccount are exists in RecordType entity.
Fix for [issue](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007XIPZMSA5) related to your recent PR ([3702](#3702)). **Error Message:** `AttributeError: is_person_type` **Issue Reason:** During load, the tasks expects the column `is+person_type` to be present in the record type table `rt_mapping_table`. This column is present for sql files which do extract after the new release of CumulusCI (v3.84.0) but will not be present for existing sql files. **Fix:** Previously the `outerjoins_to_add` function of the `AddRecordTypesToQuery` class checks if the combination of `is_person_type` and `developer_name` is unique. Now, if the `rt_mapping_table` does not have the `is_person_type` table, the task ignores the condition to check for record types based on `is_person_type` and only checks for `developer_name` (as it was previous to this PR [3702](#3702)) --------- Co-authored-by: Jaipal Reddy Kasturi <[email protected]>
W-11466074
Fixed a bug during upsert (load) of records where if the sObject had two record types with the same
DeveloperName
but differentIsPersonType
, duplicate records were being generated for load and as a result, error was thrown.Example: For the sObject
Account
, the record typePersonAccounts
hasDeveloperName = PersonAccounts
andIsPersonType = True
. I could also create another recordType such thatDeveloperName = PersonAccounts
but theIsPersonType = False
. In such cases, say I was trying to upsert 1 record (any update_key) with thisPersonAccounts
(one of the two), 2 records would try to get inserted and would throw a duplicate row error.