Search code examples
gosuguidewire

Getting Cannot change locked branch exception in Guidewire PC


I am trying to make a readonly entity to writable by using

Transaction.runwithNewBundle(\bundle -> {
   entity = bundle.add(entity)
})

but I am getting

java.lang.IllegalArgumentException: You cannot change a locked branch.

Please help me out with this.


Solution

  • That’s not really the best idea. You are trying to edit a branch (policyPeriod) that is essentially in a “thou shall not change” state. If the branch is bound or quoted and you modify it it’s likely you are at least invalidating the quote. I’d highly recommend NOT modifying a locked branch. Instead open it for edit first (if you can)