How to Remove Class Instances in Pega Development Environments
Introduction
When developing cases in Pega, you'll often create numerous test cases as your development progresses.
Over time, these test instances can accumulate, resulting in a cluttered environment that impacts testing efficiency. This tutorial explains how to clean up these instances to maintain an organized development workspace.
The Challenge
During development, your environment can quickly become filled with:
- Numerous test cases created for various testing scenarios
- Old instances with locked information
- Cluttered lists that make it difficult to find relevant test data
These accumulated instances not only make navigation more challenging but can also interfere with your testing process by introducing confusing or irrelevant data.
Solution: Using the pxDeleteClassInstances Activity
To efficiently remove test instances and start fresh with more precise test cases, Pega provides the 'pxDeleteClassInstances' activity.
This API allows you to delete instances of a specific class along with their associated artifacts, including:
- Case history
- Assignments
- Attachments
- Other related data
When to Use
The pxDeleteClassInstances activity is ideal for:
- Cleaning up your development environment between testing phases
- Removing obsolete test data that's no longer needed
- Preparing your environment for a new batch of more focused test cases
Removing instances
1 - The instances to be removed.
2 - Run the activity
3 - Check the summary
4 - Check is the instances get removed.
Important Limitations
This API is designed specifically for development or testing environments and comes with some limitations:
- It should only be used with small amounts of instances (fewer than 200)
- It's not intended for production environments
How It's Used in Pega
The pxDeleteClassInstances activity is utilized in several contexts:
1. In Pega 7 Express data modeling views to enable property type changes
2. For general cleanup of cases or other data in development environments
Notes
Remember that this functionality targets instances of classes, not the rules themselves. It removes the data objects created during testing but doesn't affect the underlying rule definitions.
Best Practices
1. Regularly clean up test instances to maintain an organized development environment
2. Use this activity between major development phases to start fresh
3. Always ensure you're working in a development or testing environment before removing instances
4. Consider backing up your environment before performing bulk instance deletion
References:
- https://support.pega.com/discussion/how-delete-specific-instances-delet…