updating dead cell in the person column using groovy script

Application Name: OPENMRS Version Number: 1.9.11

Question: I am trying to change the person’s dead and death_date cells using groovy script but it pops an error! But it does update name,birthdate_estimated without error.

Here is my code: person_id= 12040 new_given_name = “Dancille” new_birthdate = 1969-01-01

p = person.getPerson(person_id)
name = p.getNames()
bd = p.getBirthdate()

given_name = p.getGivenName()
family_name = p.getFamilyName()
println "<p> Original given name: ${given_name}</br>"
println "<p> Original family name: ${family_name}</br>"
println "<p> Original Birthdate: ${bd}</br>"

pn = p.getPersonName()
println "<p> Person name: ${pn} </br>"
p.setDeathDate(new Date())


cname = p.getNames()

println "<h3>Corrected name: ${cname}</h3></br>"

and here is the error: A javascript error has occurred: Transaction rolled back because it has been marked as rollback-only

if you comment out the p.setDead(true) and ** ** p.setDeathDate(new Date()) It would work.

How are you running this groovy script? Are you using the Groovy module?

Yes am using the groovy module