Skip to content

How to ignore Duplicate Rule when commitWork for Account/Contact/Lead? #445

Answered by ImJohnMDaniel
briancodey asked this question in Q&A
Discussion options

You must be logged in to vote

G'day @briancodey. When using the UnitOfWork, the default constructor creates the instance of the inner class SimpleDML. The fflib_SObjectUnitOfWork class relies on the IDML interface to dictate how DML operations will be handled.

With that in mind, you would create your own IDML class that sets the DMLOptions the way you need them, and then instantiate the fflib_SObjectUnitOfWork using its second constructor which accepts IDML as the second argument. For an alternate example of an IDML, refer to the other one present in the fflib_SObjectUnitOfWork class called UserModeDML.

I hope this helps. Let us know if you have more questions.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@briancodey
Comment options

Answer selected by daveespo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants