-
Notifications
You must be signed in to change notification settings - Fork 238
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
Use DMLOptions to bypass duplicate rule exceptions #1498
Changes from 5 commits
cfe546b
a95d789
bd2f1fb
31ec88c
86b3c3e
0c63f39
1a84fd0
3861c98
8adaff7
3f335d4
e188b64
058f62a
5f836fb
e9f3070
757c979
c04cb9e
d134e99
1918523
d6b0aa1
5e3d275
5aaf3b0
390e2bb
96922ac
3659a17
3a799f2
20e4e0e
cc414ad
85de930
50b05bc
60191e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1661,8 +1661,21 @@ global with sharing class RollupService { | |
masterRecords.set(outerIndex, masterRecords.get(indexOfMin)); | ||
masterRecords.set(indexOfMin, temp); | ||
} | ||
|
||
// Create DmlOptions instance | ||
|
||
Database.DmlOptions dmlOptions = new Database.DmlOptions(); | ||
|
||
// Allows save even if duplicated are detected | ||
dmlOptions.duplicateRuleHeader.allowSave = true; | ||
|
||
// Bypass duplicate rules | ||
|
||
|
||
try { | ||
return Database.update(masterRecords, allOrNothing); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these extra lines necessary? |
||
|
||
} catch (DMLException e) { | ||
// Determine if the exception is due to parent record/s having been deleted | ||
Boolean throwException = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"experimentalDecorators": true | ||
}, | ||
"include": ["**/*", "../../../.sfdx/typings/lwc/**/*.d.ts"], | ||
"paths": { | ||
"c/*": ["*"] | ||
}, | ||
"typeAcquisition": { | ||
"include": ["jest"] | ||
} | ||
"compilerOptions": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is still showing modified in your PR. Please revert this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be aligned with what's on the main branch. |
||
"experimentalDecorators": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"c/*": [ | ||
"*" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"**/*", | ||
"../../../.sfdx/typings/lwc/**/*.d.ts" | ||
], | ||
"paths": { | ||
"c/*": [ | ||
"*" | ||
] | ||
}, | ||
"typeAcquisition": { | ||
"include": [ | ||
"jest" | ||
] | ||
} | ||
} |
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.
@chininchu were you able to test this code in an environment? You've put it back the way it was and aren't including the DmlOptions anymore.
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.
Yes, I was able to test the code and it works. You should now see the DML options on my latest commit.