You need to sign in to do that
Don't have an account?
Closing a Case with Apexcode
I need to have an apex-class which can close open Cases.
I tried to update Case.status = "Closed", but the Case is not closed after this update.
Case.isclosed is not writeable. Is there a possibility to close a case with apex?
i.e. like Database.leadconvert() ?
I believe you're doing everything right. Let's see... after updating the status to 'Closed', is it changing back or staying as 'Closed'? What do you get if you query the IsClosed field after updating? Is is set to true? Just wondering if some trigger/workflow is messing w/ your Update operation?
The other thing that I can think of is whether the 'Closed' Status picklist value is marked as 'Closed'? If this doesn't make sense, go to Setup > Customize > Cases > Fields, select the 'Status' field, and see the 'Case Status Picklist Values' list at the bottom of the page. I don't expect an issue there, but just taking a wild guess...
Hope this helps.
Thanks.
All Answers
I believe you're doing everything right. Let's see... after updating the status to 'Closed', is it changing back or staying as 'Closed'? What do you get if you query the IsClosed field after updating? Is is set to true? Just wondering if some trigger/workflow is messing w/ your Update operation?
The other thing that I can think of is whether the 'Closed' Status picklist value is marked as 'Closed'? If this doesn't make sense, go to Setup > Customize > Cases > Fields, select the 'Status' field, and see the 'Case Status Picklist Values' list at the bottom of the page. I don't expect an issue there, but just taking a wild guess...
Hope this helps.
Thanks.
The value "Closed" stays in Statusfield, IsClosed is false. The Picklistvalue "Closed" is marked as Closed.
As I understand, if the picklistvalue changes to a "Closed" value, IsClosed and Closeddate should be filled automatically.
I don't know why, but it is working now ;-) I didn't change anything...
I'm having this same issue. I've updated status to Closed. When I open case status has updated but Close Case button still shows.
Something like this.