Before We Begin
There are many situations where a work object that gets created might be a replica of another work object that is already present in the system.
For instance, consider an appointment booking application where a patient tries to book appointment with a particular doctor. Application should not allow the same patient to book multiple appointments with the same doctor on the same day.
With Duplicate Search functionality in case management, we can identify cases that are duplicates of each other.
Business Scenario
Consider that we have a candidate onboarding process in a HR application, there is a policy that a Candidate who has appeared for an interview within the previous quarter for the same technology is not qualified to appear for interview another time and the profile needs to be considered as a Duplicate.
We can go over how to perform Duplicate Search and implement this scenario in PEGA v8.x.
How do we perform Duplicate Search in PEGA?
PEGA Case Management provides us with an option of βSearch Duplicate Casesβ which can be directly configured as a step in the desired stage to identify potential duplicates between the cases that are already created in the system.
In our Candidate Onboarding case type, we initially have a step that collects Basic Candidate Details like Candidate Name, PAN Number, Technology, Relevant Experience and Additional Information. Once the basic data is collected, we need to determine if the profile is a duplicate or not. We can achieve this by adding Search Duplicate Cases step to the stage.
We can configure both Basic Conditions and Weighted Conditions/ only Weighted conditions to evaluate duplicate cases.
Basic Conditions
These are all the conditions that must be matched between cases to be classified as duplicate of another case.
Weighted Conditions
These are evaluated when all the basic conditions are satisfied. In weighted conditions, each condition is assigned a weight between 1 and 100 and the aggregate weight is added up for every weighted conditions that are satisfied. A threshold weight is also needed to be specified. When the aggregated weight exceeds the threshold value, then the case is flagged as a potential duplicate.
In our scenario, if PAN Number between two cases are same, then it ideally means that the Candidate is appearing for interview another time. So, we can configure PAN Number as the basic condition.
Next we can configure if the Candidate is appearing for the same technology within the current/previous quarter. We can add Technology and Case create date time as weighted conditions with each having a weight of 50. If both these weighted conditions are met, then the current case can be tagged as a Duplicate. Hence, we can assign 100 as threshold. When both the conditions are matched, weighted conditions add up as 100, match the configured threshold and gets qualified as Duplicate.
Note: Threshold weight needs to have a value between 1 and 100; the value cannot be greater than the sum of weights assigned to individual weighted conditions.
Let us create a Candidate Onboarding case. Since this is the first case for the candidate, duplicate search doesn’t return this as duplicate.
Now, let us create another case with the same PAN Number and Technology. This time, the new case will be tagged as a Duplicate to the case CO-1.
User is presented with a OOTB form that the current case may be a duplicate. User can click on the link βWhy is this shown here?β to validate the Duplicate Case Analysis where the basic and the weighted conditions that are met are displayed along with the individual score, threshold and the aggregated score.
User can then determine to Close the case as Duplicate or Ignore and Continue.
Close this case as Duplicate asks the user to select the case ID for which the current case is Duplicate and resolves the case as Resolved-Duplicate.
Interested to know what is happening at the back-end? π§
Once a duplicate search step is configured with basic and weighted conditions along with the threshold value, a case match rule pyDefaultCaseMatch gets created at the backend in the case type class. This holds all the configurations which we added as part of Duplicate Search step.
On adding Search Duplicate step, an OOTB flow pyDuplicateSearchCases gets invoked as sub-process from current flow which takes care of identifying and handling duplicates.
Let us get into the details of what the OOTB flow pyDuplicateSearchCases does.
- Get Duplicate Cases utility executes the case match rule to determine if there are any duplicates. The list of potential duplicates that are identified are displayed in the pagelist pyDuplicateCasesReport.
- Found Duplicate Cases fork evaluates the condition to check if there are any results available in pyDuplicateCasesReport pagelist. If no, then there are no duplicates and the case proceeds as per the next steps that are configured in our case design. If yes, then the list of duplicates are displayed.
- Identified duplicates are shown to the user using flow action pyDuplicateSearchCase which calls the post activity pyDuplicateCasesPost.
If (user decides that the current case is Duplicate),
{
pyPostDuplicateSearchCases activity is called which sets the case status to Resolved-Duplicate and adds an audit history to the case
}
Else
{
status is left unchanged
}
- Resolved-Duplicate fork evaluates ResolvedDuplicate when rule. This rule will return true if the case status is set to Resolved-Duplicate. If the when rule evaluates to false, the case proceeds as per the next steps that are configured in our case design.
- End Flows utility is invoked if ResolvedDuplicate when rule evaluates to true. It calls pyEndDupSearchFlows activity which in turn calls pzEndFlows activity to end all the flows on the current work object.
Conclusion
We can make use of Duplicate Search step to identify case duplicates effectively. We can also avoid persisting duplicate cases by following the below steps,
- Create case as temporary case.
- Check for duplicates using Duplicate search step.
- Use Persist Case smart shape to persist case into DB only if it’s not a duplicate case.
We will be extending this post further for explaining temporary work objects.
π Stay Tuned !!!π
Guys good & Awesome job and very easy understanding of content. I thought Duplicate requiring track duplicate setting in case design. But not sure how duplicate achieved without fill out the track duplication tab. Could you send explaination on this question.
Thanks @Anitha s
Starting from PEGA v8.x, duplicate setting is available against the step configuration in your case life cycle. However in v7.x track duplicate configuration is available under settings tab in case design.
Please post more articles like this on case management. Explained so well, even fresher like me can easily understand.
Thanks @Aditya Kunal.
Sure we will post more on Case Management.
Happy Learning π
Backend explanation just nailed it. Fantastic job. Superb way of explanation. Keep it up OSP team.
Thanks @Prasanna
Happy Learning π
Thanks osp for this detailed explanation and thanks Aditya for pointing me and shashankey to this blog. Nice job.
Happy Learning @Chaitanya Pinnireddy π
Nice post. Clear and easy to understand.
Thanks @Shashankey Pinnireddy
Happy Learning π
Nice post. My room and office Pega friend is Aditya Kunal. All is nice on duplication. Can you send post on class stricture next article?
Thanks & Nice to hear @Cowsick Pannipolamarasetty
Please tell data prapagate and aggragate to me next post.
Lol, finally an easy to find automated solve to the terrible conundrum.
Happy Learning from OSP π
Hi OSP Team,
I think the statement below needs some correction:
“Identified duplicates are shown to the user using flow action pyDuplicateSearchCase which calls the post activity pyDuplicateCasesPost.” – The post activity does not exist on the flow action and neither in the entire application.
I am using pega 8.1.2.
Thanks..
Thank you so much for reading every minute information on our post.
Starting from v7, this activity and flow action in @baseclass gets invoked from pyDuplicateSearchCases flow rule and takes care of duplicate search. You can even see our tracer events with the activity invocation in the post.
Trace and see if you are able to see these events in the tracer. If not, please start a discussion in our Forum. We will be happy to help you anytime!
How we can find duplicate records by using Submit button. Here scenario is I have a section with three properties First name, Last Name, Gender and we have submit button. When user click the submit button, it will check that any duplicate cases is there based on these three properties.
Refer to this OOTB flow pyDuplicateSearchCases which invokes pyDuplicateSearchCases API to perform the duplicate check.
Pega creates a case match rule for each duplicate check configuration. Pass that as a parameter to pyDuplicateSearchCases activity and evaluate the condition pyDuplicateCasesReport.pxResultCount>0 to check for duplication on click of the submit button.
Happy Learning from OSP π
I am using screen flow in which work object is not created so duplicate search in that case not working , so how to use duplicate search in screen flow?