You need to sign in to do that
Don't have an account?
Inserting and then editing a case records
Hello,
I have a requirement where a case needcs to be created in a page controller, and then redirected to the case edit page where the user can make futher edits before saving. What I found however is that two recrods are created in this way, one when I insert it in my controller and another when the use clicks save on the case edit page. It was my hope that clicking save would update the existing record, not create a new one. Here is what I'm doing in my controller:
Case myCase = new Case();
.... update myCase fields....
insert myCase; // insert the case record after various fields have been updated
casePage = new ApexPages.StandardController(myCase).edit();
casePage.setRedirect(true);
return casePage;
My workaround is to redirect to the detail view of the case record and have the user edit and then save.
Any ideas of how to meet my requirement?
Thanks in advance!
I was hoping that it should update the current case only instead of creating a new one and I found the same but if you are facing difficulty. you can try following code. It will work the way you are looking for.
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.