Skip to main content
Hi Experts

 

I want to flag duplicate cases in salesforce. I know there is a way around to avoid creating duplicate cases, But in my org, I just want to flag duplicate cases. 

 

Subject field in cases is always different. If there is another case with same subject, flag that case. This is the requirement.

 

Any help on this will be highly regarded. 

 

Thanks in advance 

 

Jas

 

 
26 个回答
  1. 2021年2月10日 05:22
    Hi Jas,

     

    I tried the functionality in my org, below trigger is working for me : 

    trigger DupeCaseTrigger on Case (before insert) {

    for (Case c : Trigger.new){

    List<Case> cases = [SELECT id, Subject FROM Case WHERE Subject = :c.Subject];

    if (cases.size() > 0) {

    c.Is_Duplicate__c = TRUE;

    System.debug('###.Duplicate');

    }else

    c.Is_Duplicate__c = FALSE;

    System.debug('###.Unique');

    }

    }

     

    Hope it helps !
0/9000