function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
anil.ax822anil.ax822 

How to merge two cases that are duplicated

Hi,

i need to merge the two cases which are duplicated  request ,how it can be achieved.please help me

some one told me that use appexcahnge application,but can i achieve the same without appexchange application?

SrikanthKuruvaSrikanthKuruva

1) for the cases that will be created from now on you can write an apex trigger to avoid duplicates.

2) for the duplicate cases that already exist you can write batch apex or dotnet or java application.

anil.ax822anil.ax822

Thanks for the reply .

Will u provide some sample code for the apex triggers ,It will be more useful to me 

 

SrikanthKuruvaSrikanthKuruva

for writing the apex trigger you need to know which fields on the case the duplicate cases in your organization.

say the fields are field1 and field2. you can write  a trigger in the same lines as below

trigger dupcase on Case(before insert)

{

List<Case> liCase = [select id from Case where field1 = :trigger.new[0].field1 and field2 = :trigger.new[0].field2];

if (liCase.size() > 0)

{

trigger.new.adderror("duplicate case");

}

}

 

this is just the sample code and there can be syntax errors. and also you need to bulkify the code.

 

anil.ax822anil.ax822

Thanks for the help,

 

But now this scenorio is changed, i need to merge the two cases which are duplicate requests.

How can i do that ?

Will u provide your suggestions ?

 

SrikanthKuruvaSrikanthKuruva

when do you want to perform this check (checking duplicates)?