1

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.

hakamairi
  • 4,464
  • 4
  • 30
  • 53
pradyumn
  • 130
  • 13

3 Answers3

3

I got it resolved. Guidewire provides one field in entity called "Locked". If it is set to true, the entity cannot be modified even in the Transaction.runwithNewBundle scope.Set it to false to resolve the exception.

pradyumn
  • 130
  • 13
  • This, in the most optimistic case, would result in some PolicyPeriod inconsitency. When branch is locked, it means it already commited some chunk of consistent data to the database. Usually this is after you quote or bind the transaction. Manually altering this branch would mean inserting some 'rogue' data (not created by the legit transaction process) in the graph. So like other commented, try policyPeriod.edit() first to make sure quote is invalidated (if not bound yet), or if bound, this cannot be edited anymore (you can create policy change or renewal, though. – radekbaranowski Jun 01 '20 at 20:07
0

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)

0

Simple! You cannot edit a branch that is Locked (Quoted or Bound). Click on "Edit Policy Transaction", bring back the status to Draft.

Naresh Hawk
  • 149
  • 3
  • 5