Delete Unwanted Branches in Pega Application

Introduction

One common issue in development teams is forgetting to delete branches after they have been merged. Over time, these unused branches clutter the application, making branch management more difficult.

A common way to identify unwanted branches is to:

  • Open each branch individually.
  • Check whether it contains any rules.
  • Delete the branch if it is empty.

While this works, it is time-consuming, especially in applications with many branches.

This article shows a simple enhancement that displays both the branch creator and the number of rules directly in the Branch landing page, making it much easier to identify branches that can be safely removed.


How It Works

The solution uses the following out-of-the-box (OOTB) components:

  • Data Page: D_pxBranchContent
  • Activity: pzBranchLandingContent
  • Section: pzBranchesLabel
  • Section: pyDescriptionLabel

The enhancement displays additional information for every branch in the Branch landing page:

  • Branch creator
  • Number of rules in the branch

This allows you to quickly spot branches that contain 0 rules, which are typically safe candidates for deletion.


Step 1: Update the Branch Display Section

Open the pzBranchesLabel section.

Include the pyDescriptionLabel section.

Configure its source to use the D_pzBranchContent data page and pass the following parameter:

  • Branch ID: .pyBranchID

This enables the section to display additional information retrieved from the data page.
Also make sure , you have selected the Defer Load Contents. It opens the application rule faster.






Step 2: Modify the Activity

Open the activity:

pzBranchLandingContent

Navigate to Step 7.

Update the logic to populate the pyDescription property with the following value:

pyLanding.pxCreateOpName + "_" + pyLanding.pyCount

Where:

  • pxCreateOpName = Name of the operator who created the branch
  • pyCount = Number of rules present in the branch







Result

After making this enhancement, each branch displays information similar to:

JohnSmith_0

or

MaryJones_24

This immediately tells you:

  • Who created the branch
  • How many rules it contains

Branches with 0 rules can be quickly identified and cleaned up without opening each branch individually.



Branches which can be safely removed from the application




Benefits

  • Saves time when reviewing branches.
  • Makes branch cleanup much faster.
  • Helps identify stale or unused branches.
  • Improves overall branch management.
  • Uses existing OOTB components with only a small customization.

Conclusion

Instead of manually opening every branch to check whether it contains rules, this lightweight customization surfaces the most useful information directly on the Branch landing page.

By displaying the branch creator alongside the rule count, developers and administrators can quickly identify unnecessary branches and keep the application clean with minimal effort.

Post a Comment