You need to sign in to do that
Don't have an account?
Test Dev 81
Bypass Duplicate rule is not working
hi Everyone,
I have created a trigger on the quote to set billing contact
if contact is not available it will create a new contact also I have a duplicate rule enabled on the contact, Alert and Report checkbox is true for on create and on edit
Thanks
Rahul
I have created a trigger on the quote to set billing contact
if contact is not available it will create a new contact also I have a duplicate rule enabled on the contact, Alert and Report checkbox is true for on create and on edit
Contact c = new Contact(); c.FirstName = newQuotes[i].Billing_Contact_First_Name__c; c.LastName = newQuotes[i].Billing_Contact_Last_Name__c; c.Email = newQuotes[i].Billing_Contact_Email__c; c.AccountId = oppMap.get(newQuotes[i].SBQQ__Opportunity2__c).AccountId; c.Title = newQuotes[i].Billing_Contact_Title__c; c.Phone = newQuotes[i].Billing_Contact_Phone__c; c.Billing_Contact__c = TRUE; //bypass duplicates Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.allowSave = true; dml.DuplicateRuleHeader.runAsCurrentUser = true; Database.SaveResult sr = Database.insert(c, dml); if (sr.isSuccess()) { System.debug('Duplicate COntact has been inserted in Salesforce!'); }else{ System.debug(sr); }but the bypass is not working else part is still throwing error
[142]|DEBUG|Database.SaveResult[getErrors=(Database.Error[getFields=();getMessage=<!-- DupeBlocker blocked this action - duplicates found. --> <div style="padding:0.7em;font-size:11px;width:40em;margin:0 auto;background-color:#FBF9EE;border-color:#FCEFA1;border-width:1px;border-style:solid;border-radius:4px;">is there any solution for trigger to bypass duplicate rule
Thanks
Rahul
Greetings!
I can see that you have already used the DuplicateRuleHeader which helps you to allow to save the duplicate record as suggested below:
https://salesforce.stackexchange.com/questions/78670/disable-duplicate-check-for-apex-class
Can you please try again as suggested in the above.
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
Shirisha
i tried exact code in my my handler but it still throwing same error
Dushyant srivastava 8
is there any way to know what causing this issue
Please check if the below-mentioned App is installed in your system, if it is the case then check its configuration.
DupeBlocker (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N300000016cMzEAI)