Question


Nationwide building society
GB
Last activity: 5 Jul 2024 7:14 EDT
How to delete multiple empty branches(1000+)
Hi All,
In our development environment, we have around 1000+ empty branches which can be deleted.
Could you please tell if there is an utility or a simple approach for deleting multiple empty branches in one go?
Thanks in advance.
Regards,
Alekhya
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 5 Jul 2024 7:14 EDT


LTIMindtree
IN
@AlekhyaP16661996 So the most novel solution to do this is in 3 steps.
1. First get list of all branches in application using the Rule-RuleSet-Branch instance and passing it in D_pzRulesetsForBranch to get list of all rulesets present for each branches.
2.extract the pzinskey of each Ruleset and pass it in D_pzRulesForRulesetVersion[Key:"RULE-RULESET-NAME PRI_BRANCH_RMC-CRM-825"] to get the count of rules.
3. So your algorithm will be if the D_pzRulesForRulesetVersion.pxResult count == 0 then delete the branch using pxDeleteBranch else keep it.
P.S as mentioned below but i have done this already pzBranchesWithContent doesnt work as it gives only branches which have rulesets in it but doesnt query into RSV that it has rule count >0 or not so its not gonna work.
Try out the solution it will work for sure bit of custom work but ya should get the job done.
Regards
Soham C


Maantic Inc
IN
You can create an activity that calls the Branch API and uses the "deleteBranch" method to delete empty branches. In the "deleteBranch" method, you can specify the branch name and the "deleteEmpty" parameter as `true` to delete empty branches.


LTIMindtree
IN
@AlekhyaP16661996 Hey Hi Please use pxDeleteBranch activity to delete by passing branchID(i.e branch name).
To get list of branch id's either use Embed-RuleSetBranch instances from db to get list of all active branches in system or Rule-RuleSet-Branch from class explorer and get list.
Then execute the above pxDeleteBranch in loop and try to test it out first before running for entire batch.
Let me know if this is easier.


Nationwide building society
GB
Thank you for your response.
We are unable to find a property in Rule-RuleSet-Branch class which gives information that it is an empty branch.
Could you please help on how to fetch the list of empty branches?
Please also let us know, if there is a Pega OOTB utility which fetches empty branches and deletes it.
Thanks,
Alekhya
Updated: 27 Mar 2024 13:42 EDT


Tata Consultancy Services
IN
Yes can fetch the by using the RD and We do have OOTB RD
RD : pzActiveBranches --> This is the Report Definition, It will brings the all the BranchID from the Application
and pzBranchesWithContent --> This is the Report Definition, It will brings only those branches having the rules
I mean, If the branch already available and if rules not present in the inside branch it won't show the branch id
By executing the above two RD's and exporting the results, then comparing the two files, you will get to know. What are the empty branches available in the application stack?
pxDeleteBranch --> this activity delete the only rules inside of the branch.
I mean, It will delete the rules in side of the branch, and it won't delete the BranchID
in other words, It will still remains available in BranchID in application stack with out rules.
I hope this will help you.
Thanks,
Ashok
Accepted Solution
Updated: 5 Jul 2024 7:14 EDT


LTIMindtree
IN
@AlekhyaP16661996 So the most novel solution to do this is in 3 steps.
1. First get list of all branches in application using the Rule-RuleSet-Branch instance and passing it in D_pzRulesetsForBranch to get list of all rulesets present for each branches.
2.extract the pzinskey of each Ruleset and pass it in D_pzRulesForRulesetVersion[Key:"RULE-RULESET-NAME PRI_BRANCH_RMC-CRM-825"] to get the count of rules.
3. So your algorithm will be if the D_pzRulesForRulesetVersion.pxResult count == 0 then delete the branch using pxDeleteBranch else keep it.
P.S as mentioned below but i have done this already pzBranchesWithContent doesnt work as it gives only branches which have rulesets in it but doesnt query into RSV that it has rule count >0 or not so its not gonna work.
Try out the solution it will work for sure bit of custom work but ya should get the job done.
Regards
Soham C