How to discard and clean up other developer's checked out rules

Hi,

Sometimes you may encounter situations where your colleague developer has checked out rules but he or she cannot check in / discard them for some reasons. In my case, the developer’s operator ID was corrupted and he could never log in. Or at other times your colleague may leave the project for unexpected reasons and never come back. With any rules being checked out, you can’t lock the ruleset to release it to a production system. In this post, I am sharing how to discard and clean up the checked out rules by other operators.

  1. First, identify a checked out rule. In this example, operator “kensho.tsuchihashi” has checked out an activity rule, “MyActivity”.

  1. Log in to Dev Studio by other operator ID and do “Release lock” from Actions menu on the rule form.

  1. At this point, the state of being checked out looks like it’s gone. If you want to check out the rule, or lock the ruleset, you can.

  1. However, this is not enough. Garbage still remains in the database, and you are advised to clean them up.

4-1. Actual rule table

Identify the physical table for the rule type. There are many derived rules table and you can check it from “Test connection” button on the class form. For example, Rule-Obj-Activity is mapped to pr4_rule. You should be able to locate a rule whose pyruleset value is + @. In this example, “kensho.tsuchihashi@”.

This is the checked out rule. You can delete it and this is the same effect as discard operation.

delete from rules.pr4_rule
where pyrulename = 'MyActivity' and pyruleset = 'kensho.tsuchihashi@'

4-2. Data-Rule-Summary (pr4_rule_vw table)

When you check out a rule, the state of being checked out is stored in pr4_rule_vw table. This is not cleaned up by “Release lock” operation and should be taken care of manually.

You can delete this record as well.

delete from rules.pr4_rule_vw
where pyrulename = 'MyActivity' and pyruleset = 'kensho.tsuchihashi@'

Hope this helps.

Thanks,

@KenshoTsuchihashi

Thanks for sharing the insights. It really helps.

@KenshoTsuchihashi Very helpful information, thank you

@KenshoTsuchihashi

Really very help full article to me. Thanks a lot, i have been used this same for my issue.

Hi @KenshoTsuchihashi,

Always, your articles are awesome!

Another Scenario is if the lock release is not available from the action menu and we don’t have database access.

In that case, we can just get a pzInsKey from the query runner, and we can delete the checkout rule from the table. CheckOut rule has different pzInsKey.

For Example, we can use below query in the query runner.

Create Temp Activity and By using the method: Obj-Delete-By-Handle and Then we can delete the checkout rule from the table.

select pzinskey, pyrulename, pyruleset from {CLASS:Rule-Obj-Report-Definition} where pyrulename='pzShowTraceOpenRule'

or

select pzinskey, pyrulename, pyruleset from rules.pr4_rule where pyrulename='pzShowTraceOpenRule'

Thanks,

Ashok

Adding a question into this discussion to find out the list of checkout rules from locked rulesets and unlocked rulesets.

How to identify checkout rules for a operator?

Thanks,

Ashok

Hi @ChensuZ5,

Where are you executing Delete Query ?

If you executing Delete Query in Pega Query runner it will not work out, Pega query runner work for Select functionality.

I have mentioned the query too in above comment.

Then Execute in Pega Query Runner

Create a Temp activity and delete check out rules.

I hope this will help you

Thanks,

Ashok

@KenshoTsuchihashi

Thank you for sharing, very helpful information.

@KenshoTsuchihashi Thank you so much for posting! for some reason I got below error while executing the delete query:

Error

There was a problem performing a database query: There was a problem getting a list: code: 0 SQLState: 25006 Message: ERROR: cannot execute DELETE in a read-only transaction
DatabaseException caused by prior exception: org.postgresql.util.PSQLException: ERROR: cannot execute DELETE in a read-only transaction
| SQL Code: 0 | SQL State: 25006

Did anyone experience the same?

Thanks,

Su

@BhumireddyYesss!! you are absolutely correct. I was using query runner and failed to delete. I just used a temp activity and was able to obj-delete-by-handle. problem solved. thank you so much!

Su